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

eCommerce Search

The AngularJS-based eCommerce faceted search front-end plugin is used to for displaying ecommerce data indexed from a CSV file using a CSV collection. Please contact support@searchblox.com to get the link for downloading the plugin.

Steps to Install and Configure an AngularJS Plugin for Ecommerce Search

  1. Remove or rename the existing plugin folder here: ../webapps/searchblox.
  2. After downloading the file, expand the folder into the SearchBlox installation under ../webapps/searchblox.
  3. You can access the AngularJS-based search page here: http://localhost:8080/searchblox/plugin/index.html.
  4. To use eCommerce search, please make sure to change the key 'activeTemplate' to 'ecommerce' here: ../plugin/templateConfig.json
  1. Edit the ../plugin/data/ecommerce/facet.json file to add/modify/remove term, number range and date range filters. Refer to step number 9 below. Open the file facet.json to configure search results as required.
  2. The sample data for indexing the items can be found within the ../plugin/data/ecommerce/sample.csv file. You can modify/make changes/add data to the file, as long as the columns in the CSV file remain the same.

Create a CSV collection and specify the path to the sample data file, then map a unique field in the CSV file to a unique field in the CSV collection settings.

For the fields category, parent_category and retail, add the following entries into the csv.json file under ../searchblox/WEB-INF folder. Create the entries prior to creating the CSV collection.

 "category":{
"type":"string",
"store":"yes",
"index":"analyzed",
"analyzer":"comma_analyzer",
"include_in_all":"false"
},
"parent_category":{
"type":"string",
"store":"yes",
"index":"analyzed",
"analyzer":"comma_analyzer",
"include_in_all":"false"
},
"retail": {
"type": "double",
"store": "yes",
"index": "not_analyzed",
"include_in_all": "false"
},

You can download the sample CSV file below:
Sample CSV file.

Important note:

Making small syntax errors in csv.json will affect the functionality in SearchBlox.

  1. Add the JSON code as shown in the sample csv.json above. You can also replace the existing csv.json with the one attached.

To add, update or remove facet filters, edit the facet.json file within the /data/ecommerce directory. You can add sorting options and faceted search options on the facet.json file. You can specify which collection you want to search using the collection attribute, and which ads to display in the collection for ads field. The other fields that can be specified via facet.json are sortbtns, sortdir, pagesize, showautosuggest and matchany.

{
 
   "facets":[
        {"field": "fit", "display": "Fit","size":"10"},
        {"field": "colors",  "display": "Colors","size":"10"},
        {"field": "neck","display": "Neck","size":"10"},
        {"field": "category","display": "Category","size":"10"},
        {"field": "parent_category","display": "Parent Category","size":"10"},
        {"field": "rating","display": "Ratings","size":"10"},
 
 
        {"field": "retail","display":"Price",
        "range":[
        {"name":"0-50","from":"*","to":"50"},
        {"name":"51-100","from":"51","to":"100"},
        {"name":"101-150","from":"101","to":"150"},
        {"name":"151-200","from":"151","to":"200"},
        {"name":"201-","from":"201","to":"*"}
        ]}
 
    ],
    "collection":[ 1 ],
    "sortBtns":[
        {"field":"rating","display":"Rating"},
        {"field":"sale","display":"Sale"}
    ],
    "matchAny":"off",
    "sortDir":"desc",
    "pageSize": "9",
    "showAutoSuggest": "true",
    "categoryTree" : 1
}
  1. Make sure to restart SearchBlox and re-index the collection for the changes to take effect.
  2. Now access the angularJS based search page here:http://localhost:8080/searchblox/plugin/index.html.
  • The facets category and parent_category appear under "show results for".
  • The other facets fit, colors, neck and rating appear under "Refine by".
  • The image displayed is taken from the link in the image field in the sample CSV file.
  • When you click the image, the product link page from the productlink field in the sample CSV will be displayed.
  • Make sure to match the fields with those in the sample CSV file found here: ../plugin/data/ecommerce/sample.csv.

eCommerce Search


Suggested Edits are limited on API Reference Pages

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