Filtering Free text search results

You can search attribute names, which are an exact match or a substring of the actual attribute name. The results are achieved through attributes in the spec and associated attribute paths in the spec.

The search terms should be in the Key = Value format, for example, "color = red" where color is used as the key to match against set of attributes and red is used as the value to search for in the matching records. Similarly, multiple search attributes can be specified in the following format by using semicolon (;) as a separator:

Key = Value ; Key = Value [; Key = Value]
Search results are accurate if the specified search attribute matches exactly one attribute in the specs that are associated with a Catalog or Hierarchy. If the specified search attribute matches with more than one attribute in the specs that are associated with a Catalog or Hierarchy, then the results depend on the matching criteria that are configured by using the fts_should_match_expression property in the restConfig.properties file. By default, the value of the fts_should_match_expression property is set to 1<90%. If more than one attribute from spec matches the attribute that is specified in the search term, then the 90% clause is applied. It returns results only when floor (n x 90%) of attribute values match. Here ‘n’ is number of attributes that matched the search term.

Following types of attributes are supported:
  • String
  • Numbers
  • Dates
Note:
  • If an attribute specified matches multiple attributes of incompatible types, no results are returned. For example, if you specify date = today search term and spec has attributes that are named date (type string) and Start Date attribute (type Date) then Elasticsearch produces an unable to convert string today to date error.
  • You can exclude a term from the search operation by using a hyphen (-). For example, if you search for item-00001, then the search results show attributes names that contain "item" but not "00001".
  • Ignore trailing zeros while searching with the number type attribute. For example, search attribute1 = 19.24 instead of attribute1 = 19.24000.

Examples

  • String attribute:
    • Display records with attribute name "iphone" and color "silver":
      color=silver; name=iphone
    • No result because a phone cannot be both "silver" and "red" colored:
      color=silver red
    • Display records with either of the specified values:
      color=silver OR red
    • Display records by using "OR" operator:
      color=silver OR red ; brand=google
  • Numeric attribute:
    • Display records for phones having price higher than 2000
      price = [2000 TO *]
    • Display records for phones in the 2000 - 10,000 price range
      price = [2000 TO 10000]
  • Date attribute:
    • Display all records with specified attribute date range (2019-03-29/30/31) including lower and upper limits:
      date = [2019-03-29 TO 2019-03-31]
    • Display all records with attribute date range until 2019-03-30, but exclude 2019-03-31:
      date = {* TO 2019-03-31}
    • Display all records with attribute date range of 2019-03-29/30, but exclude upper limit 2019-03-31:
      date = [2019-03-29 TO 2019-03-31}
    • Display all records with attribute date range of 2019-03-29/30, but exclude upper and lower limits:
      date = {2019-03-29 TO 2019-03-31}
  • Mixed attributes:
    • Display all records for "oppo" phones having price higher than 2000:
      name = oppo ; price = [2000 TO *]
    • Displays all records with attribute date range of 2019-03-29/30, exclude the upper limit 2019-03-31, and price in the range 3000 - 4000:
      price = [3000 TO 4000] ; date = [2019-03-29 TO 2019-03-31}