Search
This section covers the details of how to implement search functionality on your site using Infinity.
To begin with, you need to have your API access set up.
If you want to see the documentation for the underlying API calls for search, you find them in our API reference.
Infinity Search Results
The search results from Infinity are returned in two lists; Results and RelatedResults. Products in the Results list contain the actual direct hits to the user query. Products in the RelatedResults list are products that are contextually similar to the user intent. The RelatedResults list will pick up on synonym products that are not direct hits put related to the users area of interest.
The two lists Results and RelatedResults need to be presented to the user and the best way will vary from implementation to implementation, consult your Customer Success Manager for advice if you are unsure.
Search Parameter Introduction
The search term is simply called the query.
query : the actual query as entered by the userPaging is implemented using parameters skip and take. Imagine these as operating on a hypothetical search result of a certain length. The take parameter specifies the length of the response returned by the function-call and the skip parameter specifies from where the response starts reading from the result. Both take and skip parameters are applied to Results and RelatedResults independently.
Example
skip : the number of items in the total result to skip
take : the maximum length of the returned response
skip = 20
take = 10
query = "user provided query"
'''This call will return results 21-30'''
results = search(query, skip, take)Search and Render Results
The number of returned results and related results will be between 0 and what you specified for take. You check it by reading the length of the returned results array.
C# source code on Github: SearchController.cs
Java source code on Github: SearchController.java
JavaScript source code on Github: search.js
PHP source code on Github: Simple.php
Check Engine Response
The engine returns a MakesSense value which indicates if the engine could find a reasonable match for the query in the product catalog. A False response means that the engine is not sure what the user meant and the result will be a guess. Best practice in this case is to inform the user somehow. The result may also contain spelling suggestions in which case it is recommended to show said suggestions to the user.
C# source code on Github: SearchController.cs
JavaScript source code on Github: search.js
PHP source code on Github: Simple.php
Last updated
Was this helpful?

