SearchBlox

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!

Guides

Website Search

AngularJS based Website Search front-end for SearchBlox can be used for searching websites, intranet and custom applications. Please contact support@searchblox.com to get the link for downloading the plugin.

Steps to Install and Configure an AngularJS Plugin for Website search

  • Remove or rename the existing plugin folder in ../webapps/searchblox.
  • After downloading the file, expand the folder into the SearchBlox installation under ../webapps/searchblox.
  • Access the AngularJS-based search page at http://localhost:8080/searchblox/plugin/index.html.
  • Edit the /plugin/data/facet.json file to add/modify/remove term, number range and date range filters.
  • Add sorting options and faceted search options on the facet.json file.

Facet.json is the configuration file that provides options that can be configured to provide search results as required. The path for the facet.json file, after placing the plugin folder in SearchBlox, is ../webapps/searchblox/plugin/data/facet.json. To add a new facet filter, define the field name, display name and the size of the filter values to be shown in facet.json. Facet filters can be string, number or date types. Except for the predefined facets such as keywords, title, description, size or date, if you need add more custom facets, you can add them in facet.json (eg: facet field: "category").

The collection to be searched can be specified using the collection attribute. Similarly, the collection for which ads are to be displayed can be specified in the collection for ads field. The other fields that can be specified via facet.json are sortbtns, sortdir, pagesize, showautosuggest and matchany

The contents of facet.json are shown below.

"facets":[
    {"field": "contenttype", "display": "Content Type","size":"10"}, // term facet filters
    {"field": "keywords",  "display": "Keywords","size":"10"},
    {"field": "cname","display": "Collection","size":"10"},
    {"field": "category","display": "Collection","size":"10"},
    {"field": "size","display":"Size", // number range facet filters
        "range":[
        {"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
        "dateRange":[
            {"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"}
        ]}
],
 
"collection":[], // Use collection id or list of collection ids comma separated to limit the Collections to be searched from the form field
 
"collectionForAds":[], // Use collection id or list of collection ids comma separated to limit the Featured Results to be shown to just the specified collections instead of displaying the Featured Results to all collections
 
"sortBtns":[ // Sort buttons for any field can be added here to display at the top of the results.
    {"field":"alpha","display":"Alphabetic"},
    {"field":"date","display":"Date"},
    {"field":"relevance","display":"Relevance"}
],
 
"matchAny":"off", // Match any terms "off" or "on". Default is match all terms
 
"sortDir":"desc", // sorting direction asc or desc for ascending or descending order
 
"pageSize": "10", // Number of results per page
 
"showAutoSuggest": "true" // turn off autosuggest by setting this value to false
  • If you need to add a facet field for type number or date, the field needs to be updated in ../webapps/searchblox/WEB-INF/mapping.json for web and file collections. For CSV, database, MongoDB and AWS collections, the values need to be mapped in csv.json, jdbc.json, mongodb.json, amazonS3.json respectively here: ../webapps/searchblox/WEB-INF/.

For example, if you need to add a date field "published" as a facet field, the following addition has to be made in mapping.json. Then update the field in facet.json.

Please note that you need to restart, clear and reindex if changes are made to mapping.json.

"published":{
"type":"date",
"store":"yes",
"include_in_all":"false"
},

Website Search


Suggested Edits are limited on API Reference Pages

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