Search Type features
Search type features modify how the search engine match works. Empathy Platform includes the following search type features:
- Match All Search: Performs a search to match all documents in the index.
- Match Search: Performs a search on a single field in the index.
- Multi Match Search: Performs a search on a collection of fields in the index.
- Term Search: Performs a search using an exact match query on a single field in the index.
- Browsing Search: Performs navigation using a specific value for the field, filtering results, and applying faceting and boosting configuration for the field value.
- Top Clicked Search: Performs a search for the most clicked products in the product catalog.
- Empathize Match Search: Performs a search for query suggestions and popular searches.
- Field Values: Lists all possible values for a field.
warning
You can only use one query type feature at the same time.
interact
For an explanation of how to set up the features in the Search microservice, see Feature configuration.
Match All Search
The Match All Search (matchAllSearch
) feature lets you add a query to match all fields from all documents.
Search configuration
There are no additional parameters to configure this feature.
Configuration example
{
"name": "matchAllSearch"
}
Match Search
The Match Search (matchSearch
) feature lets perform a search engine match by using the configured field
parameter. If the query
parameter is not present in the request, it applies matchAllSearch
behavior, if configured. Otherwise, it gives an exception and requests the missing query parameter.
Field | Description | Type | Default value |
---|---|---|---|
query | Query terms to search (optional) | String | - |
Query can be sent as a parameter with the format query=sample query
. The feature uses the field
name provided within the value specified through the query parameter query
if present. If the query
parameter is not present within the request and emptyQueryParamAllowed
is false
or undefined, the request gives an 400 error.
Search configuration
You configure the fields to search on in the JSON configuration file of the feature, not in the request.
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
field | Field to be used for applying the match (required) | String | --- |
queryOperator | Query operator to be used. Available values: AND , OR (optional) | String | OR |
emptyQueryParamAllowed | Determines whether a query parameter is required or not. If true , it allows requests without the query parameter (optional) | Boolean | False |
Configuration example
{
"name": "matchSearch",
"config": {
"field": "keywords",
"queryOperator": "AND",
"emptyQueryParamAllowed": true
}
}
Multi Match Search
The Multi Match Search (multiMatchSearch
) feature adds the ability to search on a collection of fields and returns the associated results.
Multi Match Search performs two functions:
- Query: It performs a search for the query term on a collection of fields.
- Equalize: It retrieves the Equalize configuration, which contains the relationship between the fields and their weighting, and adds the weights to each field so that they can be more or less significant for the query.
Configuration for query usage
Fields to search on are not configured through the request but in the JSON configuration file of the feature.
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
searchableFields | List of allowed fields to be used to search over them. It cannot be empty or null (required) | Array | --- |
tieBreaker | Capability to resolve conflicts resulting from identical product overall scores (optional) | Integer | 0.0 |
autoGenerateSynonymsPhraseQuery | Specify if match phrase queries must be created for multi-term synonyms (optional) | Boolean | false |
Configuration for Equalize
The Equalize configuration can be retrieved via JSON configuration (only for EQ Default config), via the Playboard, or by request.
EQ Default JSON configuration
The EQ Default configuration settings are established for each field via a JSON configuration in the Instance Management console. The fields that can be weighted are also handled via JSON.
The weights for the fields are calculated based on the type and the Equalize boost using the formula: field_type_multiplier * equalize_field_boost
.
The field subtypes are:
Type | Description | Multiplier |
---|---|---|
Keyword | Field with exact match | 2.0 |
Text | Field using standard tokenizer (opens new window), lowercase filter, and ASCII folding | 1.0 |
NGram | Field with text abilities and ngram tokenizer (opens new window) | 0.05 |
Derived | Field with text abilities and stemming (opens new window) | 0.2 |
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
searchableFields | List of allowed Equalized fields to be used to search over them. It cannot be empty or null (required) | Array | --- |
tieBreaker | Behavior to calculate the score (optional). Available values are detailed in a note below. | Integer | 0.0 |
autoGenerateSynonymsPhraseQuery | Specify if match phrase queries must be created for multi-term synonyms (optional) | Boolean | false |
multipliers | Overrides the search multipliers. It can only be defined for the default configuration. See the table below for more information about the available values | --- | false |
Tiebreaker values
0.0
: Take the single best score out of all the fields (for example,first_name:will
andlast_name:will
).1.0
: Add together the scores for all the fields (for example,first_name:will
andlast_name:will
).0.0 < n < 1.0
: Take the single best score plus tie-breaker, multiplied by each of the scores from other matching fields/groups.
Multipliers config
Field | Description | Mandatory |
---|---|---|
keyword | Multiplier for exact match | yes |
text | Multiplier for text match | yes |
derived | Multiplier for synonym matches | yes |
ngram | Multiplier for partial word match | yes |
useSimplifiedFieldMultiplier | In case text and derived multipliers are the same, the feature will only include derived value, as both will contain the same transformations | no |
useCompleteWords | Only takes into account complete words | no |
Configuration example
{
"name": "multiMatchSearch",
"config": {
"searchableFields": [
{
"name": "description",
"boost": 3
},
{
"name": "brand"
},
{
"name": "category",
"boost": 0
}
],
"tieBreaker": 0.1,
"autoGenerateSynonymsPhraseQuery": false,
"multipliers": {
"keyword": 2.0,
"text": 1.0,
"derived": 0.2,
"ngram": 0.05,
"useSimplifiedFieldMultiplier": true
}
}
}
Equalize configurations via the Playboard
Tailored Equalize configurations are established using the Equalize Management tool in the Empathy Platform Playboard. Weights applied are retrieved from the tool and each Equalize configuration, the EQ Default included as well, is assigned with an equalizeId
that is displayed in the configuration list of the Equalize management tool.
Equalize configurations retrieved via request
The Equalize configurations can be retrieved via request. An Equalize configuration is sent as a query parameter with the format equalize={"field1":value, "field2":value}
. The value of the parameter must be a JSON object that contains a collection of fields, and the related weight.
- Request by ID: You can additionally send a request with the parameter
equalizeId
indicating theid
(UUID) of a specific configuration to be used, having priority and being used over any other equalizes in the string. When the indicatedid
has an invalid format or a configuration with thatid
doesn't exist, a 400 Bad Request error will be returned.Equalize configuration ID
Since all the tooling features in Empathy are A/B testing-ready. You to create different relevancy models for different segments in your commerce store and easily test their performance with your favorite A/B testing tool.
Term Search
The Term Search (termSearch
) feature adds the ability to search using an exact match query on a single field and returns the associated results.
Field | Description | Type | Default value |
---|---|---|---|
query | Query term to search (required) | String | --- |
The query must be sent as a parameter with the format query=term
.
Search configuration
The field to search is configured in the JSON configuration file of the feature.
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
field | Name of the field to be used to search. It cannot be empty or null (required) | String | --- |
Configuration example
{
"name": "termSearch",
"config": {
"field": "color"
}
}
Browsing Search
The Browsing Search (browsingSearch
) feature adds the ability to navigate based on a specific value for a field. Navigating means not only filtering the results and all facets, but also applying specific faceting and boosting configuration for the selected field value.
You must send the browseField
and browseValue
parameters with the field and the value associated to filter the results.
Parameters must be sent with the format browseField=field&browseValue=value
.
Field | Description | Type | Default value |
---|---|---|---|
browseField | Field to filter the results (required) | String | --- |
browseValue | Value associated to the field to filter the results (required) | String | --- |
Search configuration
There are no additional parameters to configure this feature.
Configuration example
{
"name": "browsingSearch"
}
Top Clicked Search
The Top Clicked Search (topClickedSearch
) feature lets you query the most clicked products in the catalog. Once configured, the filters listed in the configuration can be used as query parameters.
For example, if the feature is configured with the filters lang
and scope
, the query parameters are: lang=en&scope=mobile
.
When a filter is configured, only the products that strictly match the corresponding query parameter are returned. This means that:
- If there is a query parameter, the products matching the query parameter are returned.
- If there is NO query parameter, only the products without a value for that filter are returned.
You can enable a Redis cache to cache the results of the Top Clicked query.
Search configuration
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
idFieldName | Name of the field used as productId in the product catalog (required) | String | --- |
filters | Filters to be applied when querying the top-clicked index (optional) | Array | --- |
redisCached | Enable Redis cache (optional) | Boolean | --- |
redisTTL | Time-to-live for the data in Redis cache, in seconds (optional) | Integer | --- |
Filters parameters
Field | Description | Type | Default value |
---|---|---|---|
queryParam | Name of the query parameter (required) | String | --- |
field | Name of the field in the top-clicked index (optional) | Array | Value set for queryParam |
Configuration example
{
"name": "topClickedSearch",
"config": {
"idFieldName": "groupId",
"filters": [
{
"queryParam": "scope",
"field": "filters.scope"
}
],
"redisCached": true,
"redisTTL": 250
}
}
Empathize Match Search
The Empathize Match Search (empathizeMatchSearch
) feature lets you run an Elastic match by using the configured field
and applying a matchAll
if the query parameter is not present within the request and the configuration allows that behavior. Otherwise, it returns an exception asking for a missing query
parameter.
Field | Description | Type | Default value |
---|---|---|---|
query | Query terms to search (optional) | String | --- |
The query can be sent as a parameter with the format query=sample query
. The feature uses the field
name provided within the value specified through the query parameter query
if present. If the query
parameter is not present within the request and emptyQueryParamAllowed
is false
or undefined, the request gives a 400 error.
Search configuration
The field to search is configured in the JSON configuration file of the feature.
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
field | Field to be used for applying the match (required) | String | --- |
queryOperator | Query operator to be used. Allowed operators: AND , OR (optional) | String | OR |
emptyQueryParamAllowed | Determines whether empty query parameters are allowed. If true , it allows requests without query parameter (optional) | Boolean | false |
excludeExactMatch | Determines whether exact matches are allowed. If true , it removes the results that exactly match the query (optional) | Boolean | false |
Configuration example
{
"name": "empathizeMatchSearch",
"config": {
"field": "keywords",
"queryOperator": "AND",
"emptyQueryParamAllowed": true,
"excludeExactMatch": false
}
}
Field Values
The Field Values (fieldvalues
) feature lets you list all the possible values for a field. The accepted fields can be configured in two ways:
- Fields configured as
allowedFields
in the client.json file. - Attribute fields can be informed as query parameters, but they must be a subset of the fields included in the configuration.
The endpoint accepts a query parameter attribute
in the request. Where the query parameter is informed, an aggregation for that field is included in the response. Only one field is accepted.
Example:
attribute=fieldName
Search configuration
You configure the fields to be used in the JSON configuration.
Config parameters
Field | Description | Type | Default value |
---|---|---|---|
allowedFields | Fields that can be sent as parameters for this feature (required) | String | --- |
field | Field name (required) | String | --- |
aggregationSize | Maximum size the aggregation should have (required) | Integer | --- |
aggregationField | Elasticsearch property by which the aggregations should be made (required) | String | --- |
Configuration example
{
"name": "fieldValues",
"config": {
"allowedFields": [
{
"field": "brand",
"aggregationSize": 21000,
"aggregationField": "facet_brandName"
}
]
}
}