Skip to content

Commit 01217e8

Browse files
authored
feat(relevance): enable alternative names query rule (#195)
see #194 for info and queries to try
1 parent 4f780cc commit 01217e8

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

src/__tests__/__snapshots__/config.test.js.snap

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ Object {
1111
Object {
1212
"condition": Object {
1313
"anchoring": "is",
14-
"pattern": "{facet:_searchInternal.concatenatedName}",
14+
"pattern": "{facet:_searchInternal.alternativeNames}",
1515
},
1616
"consequence": Object {
1717
"params": Object {
1818
"automaticOptionalFacetFilters": Array [
19-
"_searchInternal.concatenatedName",
19+
"_searchInternal.alternativeNames",
2020
],
2121
},
2222
},
23-
"description": "promote exact matches (old, delete me in a next PR)",
24-
"objectID": "promote-exact-old",
23+
"description": "promote exact matches",
24+
"objectID": "promote-exact",
2525
},
2626
],
2727
"indexSettings": Object {
2828
"attributesForFaceting": Array [
29-
"filterOnly(_searchInternal.concatenatedName)",
29+
"filterOnly(_searchInternal.alternativeNames)",
3030
"searchable(keywords)",
3131
"searchable(computedKeywords)",
3232
"searchable(owner.name)",
@@ -65,7 +65,8 @@ Object {
6565
"replaceSynonymsInHighlight": false,
6666
"searchableAttributes": Array [
6767
"unordered(_searchInternal.popularName)",
68-
"name, _searchInternal.concatenatedName, description, keywords",
68+
"name, description, keywords",
69+
"_searchInternal.alternativeNames",
6970
"owner.name",
7071
"owners.name",
7172
],

src/config.js

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ const defaultConfig = {
1818
indexSettings: {
1919
searchableAttributes: [
2020
'unordered(_searchInternal.popularName)',
21-
'name, _searchInternal.concatenatedName, description, keywords',
21+
'name, description, keywords',
22+
'_searchInternal.alternativeNames',
2223
'owner.name',
2324
'owners.name',
2425
],
2526
attributesForFaceting: [
26-
'filterOnly(_searchInternal.concatenatedName)' /* optionalFacetFilters to boost the name */,
27+
'filterOnly(_searchInternal.alternativeNames)' /* optionalFacetFilters to boost the name */,
2728
'searchable(keywords)',
2829
'searchable(computedKeywords)',
2930
'searchable(owner.name)',
@@ -62,33 +63,18 @@ const defaultConfig = {
6263
],
6364
indexRules: [
6465
{
65-
objectID: 'promote-exact-old',
66-
description: 'promote exact matches (old, delete me in a next PR)',
66+
objectID: 'promote-exact',
67+
description: 'promote exact matches',
6768
condition: {
68-
pattern: '{facet:_searchInternal.concatenatedName}',
69+
pattern: '{facet:_searchInternal.alternativeNames}',
6970
anchoring: 'is',
7071
},
7172
consequence: {
7273
params: {
73-
automaticOptionalFacetFilters: ['_searchInternal.concatenatedName'],
74+
automaticOptionalFacetFilters: ['_searchInternal.alternativeNames'],
7475
},
7576
},
7677
},
77-
// not yet enabled, but to be done in a replica after this is merged and
78-
// in production
79-
// {
80-
// objectID: 'promote-exact',
81-
// description: 'promote exact matches',
82-
// condition: {
83-
// pattern: '{facet:_searchInternal.alternativeNames}',
84-
// anchoring: 'is',
85-
// },
86-
// consequence: {
87-
// params: {
88-
// automaticOptionalFacetFilters: ['_searchInternal.alternativeNames'],
89-
// },
90-
// },
91-
// },
9278
],
9379
};
9480

0 commit comments

Comments
 (0)