iPhone 256gb would see no results.
Showing relevant results is better than showing none.
Query expansion strategies
To support query expansion, Algolia offers theremoveWordsIfNoResults parameter.
It defines how Algolia modifies queries with no results by removing words based on one of four strategies:
none (default), lastWords, firstWords, allOptional.
Use search analytics to identify typical patterns:
- Which terms usually appear first in queries.
- Which terms correlate with clicks or conversions.
- Which ones most often lead to “no results”.
allOptional works like the optionalWords parameter,
which is sent at query time.
For more information,
see Creating a list of optional words.How to apply a query expansion strategy
You can configure theremoveWordsIfNoResults parameter in one of the API clients.
- Go to the Algolia dashboard and select your Algolia .
- On the left sidebar, select Search.
- Select your Algolia index and open the Configuration tab.
- Select Search behavior > No results behavior.
- Select your strategy.
Test your query expansion strategy
To check whether the strategy works for your users’ typical search patterns, apply the strategy and test queries in the dashboard. To validate your strategy, consider running an A/B test with:- Control (A): set
removeWordsIfNoResultstonone. - Variant (B): set
removeWordsIfNoResultsto use your chosen strategy.
- Fewer “no results” in search analytics.
- No significant drop in click and conversion rates.
Non-alphanumeric characters
When you changeremoveWordsIfNoResults from its default none,
this can affect how Algolia applies special processing to queries with non-alphanumeric characters:
- Algolia can treat hyphens and other characters as separators. For example, the query
t-shirtmay matchtshirtandt shirt. For more information, see Splitting and concatenation - Algolia enforces the order of words in a query. For example,
t-shirtmatchest-shirtbut notshirt t. For more information, see Tokenization.
XYZ-b5,
you might expect the query to eventually match only XYZ.
But because of concatenation and tokenization,
it matches XYZ b5 or XYZb5, not only XYZ.