Fulltext Search Features
Luigi's Box Search automatically handles typos, partial matches, and other query imperfections to ensure users find relevant products even when their input isn't perfect.
Automatic Query Correction
When a search query yields no results or very low relevance, our system automatically attempts to augment the query to find a match. This process is transparent to the user but can be displayed in the UI to inform them of the change.
There are three ways a query can be automatically corrected:
Typo Correction
If a query includes a typo (e.g., searching for sheos instead of shoes), the system corrects it before executing the search. This prevents "no results" screens caused by simple spelling errors.
Example Correction:
<strike>sheos</strike> <b>shoes</b>
Partial Matches
If a multi-word query returns no results because one term doesn't exist in the catalog (e.g., searching for shoes whiskey where whiskey is not in the index), the system may ignore the problematic term and search for the valid one.
Example Correction:
shoes <strike>whiskey</strike>
Code Correction
If a user searches for a product code that doesn't strictly match (e.g., 6834a88asc) but is very close to an existing one (e.g., 6834a77asb), the system can correct the code to find the intended product. Note that code matching is typically strict, so this correction applies only when no exact match is found.
Example Correction:
6834a<strike>88asc</strike>
Displaying Corrections
In all cases, the API response includes a correction object with the original and corrected queries. You can use the HTML representation provided in the response to show users exactly how their query was interpreted.
Query Rewrite
Query rewrite is a way to control your search and autocomplete results. You can set up query rewrites in Luigi's Box application and they will have an effect on autocomplete and search results.
If you are using search.js then query rewrite will work out of the box and no integration is necessary on your side.
If you are using API to build search, then you must adapt your code to incorporate some functionality of query rewrite.
Each query rewrite has exactly one search query it responds to (diacritics and case do not matter). You can choose if you want to rewrite query, or keep the original one. You can also define filters, which will be applied to your search requests for given query.
When creating query rewrite, you can choose if you want to admit to the customer, that you have rewritten the original query. You can also define a message, which will be shown in case of applying query rewrite.
{
"query_rewrite": {
"id": 9,
"original_query": "mini guitar",
"admit_rewrite": true,
"message": "We rewrote your entered query to another with better search results for you."
}
}