Fetch Results
For any primary query to your search platform, you can perform a secondary query to Never Null and get results that enhance your own. This topic shows you how to construct and send a secondary query to Never Null’s REST API using the Solr query language.
To use the API, you need these items from Lucidworks:
-
Your short customer name
-
Your query profile name
-
Your credentials
If your content was recently ingested for the first time, Lucidworks will inform you when the initial model training is complete and your Never Null data is ready to query. |
Authentication
Before you can begin fetching Never Null results, you must log in to the service as shown below:
curl -i -H "content-type:application/json" -X POST -d '{"username":"username","password":"password"}' 'https://name.b.lucidworks.com/api/session?realmName=native'
Never Null returns a cookie, as in the example below:
HTTP/1.1 201 Created Date: Mon, 03 May 2021 22:37:57 GMT Content-Length: 0 Connection: keep-alive Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Content-Type-Options: nosniff Strict-Transport-Security: max-age=15724800; includeSubDomains X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1 ; mode=block Referrer-Policy: no-referrer Set-Cookie: id=eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInBlcm1pc3Npb25zIjpbXSwic2NvcGUiOlsib3BlbmlkIiwiZW1haWwiLCJwcm9maWxlIl0sImlzcyI6Imh0dHA6XC9cL3Byb3h5OjY3NjRcL29hdXRoMlwvZGVmYXVsdCIsInJlYWxtIjoibmF0aXZlIiwiZXhwIjoxNjIwMDgzMjM2LCJ1c2VySWQiOiIwMzhkM2ZmYy1jNDJhLTQ5NGItYTY1ZS04ZGExNzFkMDc4MGQiLCJpYXQiOjE2MjAwODE0MzYsInBlcm1pc3Npb25zX3ZzIjo0Mjk0OTY4MTA5LCJhdXRob3JpdGllcyI6WyJhZG1pbiJdfQ.e3ipLvtx0H4do4Ads5mD0ABV2sn6hB0QBZXxSH4b2DxJe5sbvx3OWBhqw3AgXp7ilnNSlCuYfwG7VjhpDGpGanc68eihUkuNzRjIX1THZAaJK3ZmiebUH4ey7tFnavHp17foPtNGQTMAtui9svEdUiJAcP8YkFC1-hpIozaD2b-EFQjCoCxfif3yOtyBIyfG80o9EZdRF7JSSSOdZ5w3wbOsFDKul0w61Zq_5kk_Z4lw7fhvJAneMst_gLTNscenj7daBbxQ0Ved0XteLD6Ob3HxWTA1R2HvkD1JETtZr6v4okXY30-h5ES0aO3UnXadWfDaOe24HqNb3-e0bSnjGg; Path=/; Max-Age=1759; Expires=Mon, 03 May 2021 23:07:16 GMT; HttpOnly
Query URL format
The request URL includes the short customer name and query profile name assigned to you by Lucidworks, along with a query string:
https://name.b.lucidworks.com/api/query/profileName?q=QUERY-STRING...
Response format
The response is a JSON response where each item includes these fields:
-
Product ID
-
Short product description
-
Similarity score
-
Additional objects that reflect the input parameters
Example request and response
As "bigbox", query a profile named 'bigbox_en' for the misspelled term "dvdplayr".
Request
curl -u USERNAME:PASSWORD https://bigbox.b.lucidworks.cloud/api/query/bigbox_en?q=dvdplayr
Response
{
"response" : {
"docs" : [ {
"description_s" : "Dynex™ - Refurbished 9\" Portable DVD Player",
"id" : "1559547",
"score" : 0.685536
}, {
"description_s" : "Dynex™ - Refurbished 7\" Portable DVD Player",
"id" : "1559538",
"score" : 0.659592
}, {
...
}
}