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

Yes, we can add custom facets using custom/meta fields for the collection which got indexed from meta tags, property fields, entity, and sentiment fields in faceted search.

 Step 1:

Add the custom field in mapping file based on your collection type:

- For custom fields in HTTP, File collection, RSS collection, and custom collections add the fields in ../webapps/searchblox/WEB-INF/mapping.json.

- For custom fields in CSV collections, add the snippet in ../webapps/searchblox/WEB-INF/csv.json.

- For Database collections, add the snippet in ../webapps/searchblox/WEB-INF/jdbc.json.

- For MongoDB collections, add the snippet in ../webapps/searchblox/WEB-INF/mongodb.jso

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": true,
"analyzer": "sb_analyzer"

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

More on Analyzers:

Step 2:

Clear and Re-index the collection(s).

Step 3:

Add the custom facet in ../webapps/searchblox/plugin/index.html.

facets: [

"field": "custom",
"display": "Custom Field",
"size": "10"

"field": "colname",
"display": "Collection Name",
"size": "10"
"field": "contenttype",
"display": "File Type",
"size": "10"
"field": "keywords",
"display": "keywords",
"size": "10"

To learn more about SearchBlox please visit our developer document site

Have more questions? Submit a request