Azure AI Search - singular vs plural search terms

Vilhelm Heiberg 11 Reputation points
2024-08-14T07:56:46.63+00:00

I have a search index in Azure AI Search using the newest version of the API (2024-07-01). I have added searchable text fields with analyzer and synonym maps. I am using the "en.microsoft" lexical analyzer.

I have some problems with language handling of the query search term. More specifically, I have problems with handing of singular vs plural.

When I search with the term "squat" I get results containing "squat" or "squats". This is expected.

But when I search with the term "squats" (plural form) I only get results containing "squats". I was expecting the system to also return results containing "squat".

This example was in English, but I also have a Norwegian search index and I face the same singular/plural problem there, using the "nb.microsoft" lexical analyzer.

What do I have to do to solve this?

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,356 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 19,301 Reputation points Moderator
    2024-08-19T22:42:00.8233333+00:00

    Hello @Vilhelm Heiberg there are a couple of ways to address the singular vs. plural search term issue in Azure AI Search:

    • You can utilize Wildcard Searches. Azure AI Search supports wildcard searches using the asterisk () symbol. For your example, you can search for "squat" which would return results containing both "squat" and "squats". However, wildcard searches can be less precise and could potentially return unexpected results. Use them cautiously.
    • Another option is to customize the Lexical Analyzer. The "en.microsoft" and "nb.microsoft" analyzers are designed for general-purpose use. If you have specific requirements for handling singular and plural forms, you can create a custom lexical analyzer using Apache Lucene analyzers.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.