Can we add custom facets from custom/meta fields in faceted search

Yes, we can add custom facets using custom fields that has been indexed from meta tag, property fields, entity and sentiment fields in faceted search.

 

Step 1:

Add the field in ../webapps/searchblox/WEB-INF/mapping.json

eg: add the following snippet in mapping.json for each custom field, please give the name of the custom field in the beginning 

"custom": {
"type": "text",
"store": "yes",
"index": "analyzed",
"analyzer": "sb_analyzer",
"include_in_all": "false"
},

If the values are comma separated then you can use "analyzer" as "comma_analyzer"

More on Analyzers: 

https://developer.searchblox.com/docs/analyzers-in-searchblox

Step 2:

Add the facet in ../webapps/searchblox/plugin/index.html at around line number 100 as below

facets: [

{'field': 'custom', 'display': 'Custom Field'},
{'field': 'contenttype', 'display': 'Content Type'},
{'field': 'keywords', 'display': 'Keywords'},
{'field': 'colname','display': 'Collection'}
]

 Step 3:

Clear and Index Collections

 

 

Have more questions? Submit a request

Comments