Related Queries in Search and API

Related Queries Search

Related Queries Search Configuration

This feature is disabled by default. To enable and configure the settings with plugin search please edit the facet.js which can be found under the path <SEARCHBLOX_INSTALLATION_PATH>/webapps/ROOT/search/facet.js as below:

757

Set 'relatedQuery' to true.

Related Queries Search Response

As the limit is set to 5, we will get 5 related query suggestions based on indexed document content of collection(s). You can see the response in the screenshot below:

791

Related Queries via API

Using Related Queries API we can get related queries based on the search term used.
There are various parameters that can be configured to get the related terms to a search query. Please refer to the following section on Related Queries API

API Request

https://localhost:8443/rest/v2/api/related/query

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Headers

SB-PKEY
LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==

Document Syntax

{
"apikey":"ADB9E38C363A5AB7B17E34956D21543B",
"field":"content",
"col":"1,2,3",
"type":"phrase",
"operator":"or",
"limit":20,
"terms":5,
"query":"test"
}

Document Description

JSON AttributeDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
fieldfield is the field from which the related search terms are to be fetched eg: content, keywords, title, description or custom meta field
colCollection ID
typewhether it is phrase or fuzzy search for related terms
phrase refers to exact match
fuzzy refers to fuzzy match (approximate matches)
operatorAND or OR operator between the terms if multiple words are available in search term
limitnumber of related queries returned
termsnumber of associated terms returned for each query
querysearch query
SB-PKEYSB-PKEY is an additional security key can be found for SBAdmins and Admin Users under Users Tab of Admin Console Screen.

Sample JSON Response

814