Skip to content

Commit

Permalink
feat(relevance): enable alternative names query rule (#195)
Browse files Browse the repository at this point in the history
see #194 for info and queries to try
  • Loading branch information
Haroenv committed May 31, 2018
1 parent 4f780cc commit 01217e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
13 changes: 7 additions & 6 deletions src/__tests__/__snapshots__/config.test.js.snap
Expand Up @@ -11,22 +11,22 @@ Object {
Object {
"condition": Object {
"anchoring": "is",
"pattern": "{facet:_searchInternal.concatenatedName}",
"pattern": "{facet:_searchInternal.alternativeNames}",
},
"consequence": Object {
"params": Object {
"automaticOptionalFacetFilters": Array [
"_searchInternal.concatenatedName",
"_searchInternal.alternativeNames",
],
},
},
"description": "promote exact matches (old, delete me in a next PR)",
"objectID": "promote-exact-old",
"description": "promote exact matches",
"objectID": "promote-exact",
},
],
"indexSettings": Object {
"attributesForFaceting": Array [
"filterOnly(_searchInternal.concatenatedName)",
"filterOnly(_searchInternal.alternativeNames)",
"searchable(keywords)",
"searchable(computedKeywords)",
"searchable(owner.name)",
Expand Down Expand Up @@ -65,7 +65,8 @@ Object {
"replaceSynonymsInHighlight": false,
"searchableAttributes": Array [
"unordered(_searchInternal.popularName)",
"name, _searchInternal.concatenatedName, description, keywords",
"name, description, keywords",
"_searchInternal.alternativeNames",
"owner.name",
"owners.name",
],
Expand Down
28 changes: 7 additions & 21 deletions src/config.js
Expand Up @@ -18,12 +18,13 @@ const defaultConfig = {
indexSettings: {
searchableAttributes: [
'unordered(_searchInternal.popularName)',
'name, _searchInternal.concatenatedName, description, keywords',
'name, description, keywords',
'_searchInternal.alternativeNames',
'owner.name',
'owners.name',
],
attributesForFaceting: [
'filterOnly(_searchInternal.concatenatedName)' /* optionalFacetFilters to boost the name */,
'filterOnly(_searchInternal.alternativeNames)' /* optionalFacetFilters to boost the name */,
'searchable(keywords)',
'searchable(computedKeywords)',
'searchable(owner.name)',
Expand Down Expand Up @@ -62,33 +63,18 @@ const defaultConfig = {
],
indexRules: [
{
objectID: 'promote-exact-old',
description: 'promote exact matches (old, delete me in a next PR)',
objectID: 'promote-exact',
description: 'promote exact matches',
condition: {
pattern: '{facet:_searchInternal.concatenatedName}',
pattern: '{facet:_searchInternal.alternativeNames}',
anchoring: 'is',
},
consequence: {
params: {
automaticOptionalFacetFilters: ['_searchInternal.concatenatedName'],
automaticOptionalFacetFilters: ['_searchInternal.alternativeNames'],
},
},
},
// not yet enabled, but to be done in a replica after this is merged and
// in production
// {
// objectID: 'promote-exact',
// description: 'promote exact matches',
// condition: {
// pattern: '{facet:_searchInternal.alternativeNames}',
// anchoring: 'is',
// },
// consequence: {
// params: {
// automaticOptionalFacetFilters: ['_searchInternal.alternativeNames'],
// },
// },
// },
],
};

Expand Down

0 comments on commit 01217e8

Please sign in to comment.