diff --git a/src/__tests__/__snapshots__/config.test.js.snap b/src/__tests__/__snapshots__/config.test.js.snap index 7b28bc9c7..07aacad32 100644 --- a/src/__tests__/__snapshots__/config.test.js.snap +++ b/src/__tests__/__snapshots__/config.test.js.snap @@ -23,6 +23,69 @@ Object { "description": "promote exact matches", "objectID": "promote-exact", }, + Object { + "condition": Object { + "anchoring": "contains", + "pattern": "author\\\\: {facet:owner.name}", + }, + "consequence": Object { + "params": Object { + "automaticFacetFilters": Array [ + "owner.name", + ], + "query": Object { + "remove": Array [ + "author\\\\:", + "{facet:owner.name}", + ], + }, + }, + }, + "description": "filter on author: {owner.name}", + "objectID": "author:owner", + }, + Object { + "condition": Object { + "anchoring": "contains", + "pattern": "owner\\\\: {facet:owner.name}", + }, + "consequence": Object { + "params": Object { + "automaticFacetFilters": Array [ + "owner.name", + ], + "query": Object { + "remove": Array [ + "owner\\\\:", + "{facet:owner.name}", + ], + }, + }, + }, + "description": "filter on owner: {owner.name}", + "objectID": "owner:owner", + }, + Object { + "condition": Object { + "anchoring": "contains", + "pattern": "keyword\\\\: {facet:keywords}", + }, + "consequence": Object { + "params": Object { + "automaticFacetFilters": Array [ + "keywords", + ], + "query": Object { + "remove": Array [ + "keyword\\\\:", + "{facet:keywords}", + ], + }, + }, + }, + "description": "filter on keyword: {keywords}", + "objectID": "keyword:keyword", + }, ], "indexSettings": Object { "attributesForFaceting": Array [ diff --git a/src/config.js b/src/config.js index c1613706b..d1aa50b38 100644 --- a/src/config.js +++ b/src/config.js @@ -77,6 +77,54 @@ const defaultConfig = { }, }, }, + { + condition: { + pattern: 'author\\: {facet:owner.name}', + anchoring: 'contains', + }, + consequence: { + params: { + automaticFacetFilters: ['owner.name'], + query: { + remove: ['author\\:', '{facet:owner.name}'], + }, + }, + }, + description: 'filter on author: {owner.name}', + objectID: 'author:owner', + }, + { + condition: { + pattern: 'owner\\: {facet:owner.name}', + anchoring: 'contains', + }, + consequence: { + params: { + automaticFacetFilters: ['owner.name'], + query: { + remove: ['owner\\:', '{facet:owner.name}'], + }, + }, + }, + description: 'filter on owner: {owner.name}', + objectID: 'owner:owner', + }, + { + condition: { + pattern: 'keyword\\: {facet:keywords}', + anchoring: 'contains', + }, + consequence: { + params: { + automaticFacetFilters: ['keywords'], + query: { + remove: ['keyword\\:', '{facet:keywords}'], + }, + }, + }, + description: 'filter on keyword: {keywords}', + objectID: 'keyword:keyword', + }, ], };