Search Query API
The SearchBlox Collections API enables the user to get related queries and top queries from SearchBlox using simple HTTP POST and GET actions. Searchblox Collection API provides methods to fetch related and top queries using REST requests with JSON payloads.
New Search API
This is the new Search API that is being used for the secure search from 9.2. Users can also use the same to get JSON results for their search.
URL
http://localhost:8080/searchblox/rest/v2/api/search?query=*
Method
GET
params
Below given are basic mandatory parameters. There are wide variety of parameters that are supported, please refer Search Parameters
param | description |
---|---|
query | search query |
Header
Header | Description |
---|---|
X-Correlation-ID | A unique identifier that can be sent through the search API request. The X-Correlation-IDs will be logged in ../webapps/searchblox/logs/query.log and can also be viewed in exported query logs file from SearchBlox Analytics. |
Returns
The JSON results from SearchBlox by default
Old Search API
This is the search servlet API that SearchBlox has been supporting from the beginning.
URL
http://localhost:8080/searchblox/servlet/SearchServlet?query=*
Method
GET
params
Below given are basic mandatory parameters. There are wide variety of parameters that are supported, please refer Search Parameters
param | description |
---|---|
query | search query |
xsl | xsl=json for JSON output xsl=xml for XML output |
Header
Header | Description |
---|---|
X-Correlation-ID | A unique identifier that can be sent through the search API request. The X-Correlation-IDs will be logged in ../webapps/searchblox/logs/query.log and can also be viewed in exported query logs file from SearchBlox Analytics. |
Returns
The JSON results from SearchBlox for parameter xsl=json and XML results for parameter xsl=xml.
Related Queries API
Index URL
http://localhost:8080/searchblox/rest/v2/api/related/query
Method
POST
Media Type
application/json
Headers
content-type : application/json
accept: application/json
Document Syntax
{
"apikey":"ADB9E38C363A5AB7B17E34956D21543B",
"field":"content",
"col":"1,2,3",
"type":"phrase",
"operator":"or",
"limit":20,
"terms":5,
"query":"test"
}
Document Description
JSON Fields | Value |
---|---|
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
field | field is the field from which the related search terms are to be fetched eg: content, keywords, title, description or custom meta field |
col | collection id |
type | whether it is phrase or fuzzy search for related terms phrase refers to exact match fuzzy refers to fuzzy match (approximate matches) |
operator | AND or OR operator between the terms if multiple words are available in search term |
limit | number of related queries returned |
terms | number of associated terms returned for each query |
query | search query |
Top Queries API
Index URL
http://localhost:8080/searchblox/rest/v2/api/query/top
Method
POST
Media Type
application/json
Headers
content-type : application/json
accept: application/json
Document Syntax
{
"apikey":"ADB9E38C363A5AB7B17E34956D21543B",
"col":1,
"limit":12
}
Document Description
JSON Fields | Value |
---|---|
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
col | collection id |
limit | Number of top queries returned |
Updated over 4 years ago