SearchBlox Developer Hub

Welcome to the SearchBlox developer hub. Here you will find comprehensive guides and documentation to help you start working with SearchBlox as quickly as possible, as well as support if you get stuck. Let's jump right in!


Custom Fields in Search

Adding Custom Fields in Faceted Search

SearchBlox fields such as title, keywords, language, etc., as well as custom fields such as meta fields for HTTP collections, author and subject fields for file collections can be added as facets in faceted search. All fields indexed via CSV, Database and MongoDB collections can also be added as facets in faceted search.

Steps to Add Facets

Step 1:
Stop SearchBlox.

Step 2:
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.
In Database collections, add the snippet in ./webapps/searchblox/WEB-INF/jdbc.json.
And for MongoDB collections, add the snippet in ./webapps/searchblox/WEB-INF/mongodb.json.

Add the following snippet in mapping.json, csv.json, jdbc.json or mongodb.json based on the collection for each custom field. Enter the name of the custom field in the beginning
"customfieldname": {
"type": "text",
"store": "yes",
"fielddata": true,
"index": "analyzed",
"analyzer": "comma_analyzer",
"include_in_all": "false"

"subject": {
"type": "text",
"store": "yes",
"index": "analyzed",
"fielddata": true,
"analyzer": "comma_analyzer",
"include_in_all": "false"

Add the above snippet without making any syntax errors. Add the field after another field without missing any commas.

Step 3:
In order to add these facets, the facets needs to be updated in ../webapps/searchblox/plugin/data/facet.json
as below:

    {"field": "contenttype", "display": "Content Type","size":"10"}, // term facet filters
    {"field": "keywords",  "display": "Keywords","size":"10"},
    {"field": "cname","display": "Collection","size":"10"},
    {"field": "subject","display": "Collection","size":"10"},
    {"field": "size","display":"Size", // number range facet filters
        {"name":"&lt 100kB","from":"*","to":"102400"}, // define the from and to values to setup a range
        {"name":"100kB to 500kB","from":"102400","to":"512000"},
        {"name":"500kB to 1MB","from":"512000","to":"1048576"},
        {"name":"1MB to 10MB","from":"1048576","to":"10485760"},
        {"name":"10MB &gt","from":"10485760","to":"*"} // * can be used to define the higher or lower ranges
    {"field": "lastmodified","display":"Modified Date", // date range facet filters
            {"name":"Last 24 hours","calendar":"days","value":"1"}, // look back values can be specified in days, months, years within the calendar
            {"name":"Past Week","calendar":"days","value":"7"},
            {"name":"Past Month","calendar":"months","value":"1"},
            {"name":"Past Year","calendar":"years","value":"1"}

Step 4:
Start SearchBlox and reindex.

  • Custom fields will only be added as filter facets using the steps above.
  • Custom fields can either appear as filter facets or they can be searched. Both cannot happen simultaneously.
  • If you want custom fields to be searchable, follow the instructions in the below section.
    Please note that a field can be mapped only once in the JSON file

Making Custom Fields Searchable

By default, custom fields from HTTP, File and Custom collections cannot be searched even if they are added as facets using the steps outlined in the above section.

If you need the content from meta fields or custom fields to be searched, add the following mapping to the mapping.json file found within the /searchblox/WEB-INF folder. Restart SearchBlox and then reindex the collection.

"type": "text",
"copy_to": "custom_all"

Applicable for HTTP, File, RSS and Custom Collection

Custom Fields in Search

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.