The search for different word forms allows you to search for nouns in the singular or plural, adjectives in the degree of comparison, forms of regular and irregular verbs, etc.
Search for different word forms is enabled if the UseWordFormsSearch property of the SearchOptions class is set to true. By default, the search for different word forms is disabled.
To generate various forms of words, a class that implements the IWordFormsProvider interface is used. The default class is EnglishWordFormsProvider, which supports English-only word forms. To add support for word forms in other languages, see the Word forms provider page.
The following example demonstrates how to perform search for different word forms in an index.
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder=@"c:\MyDocuments\";// Creating an index in the specified folderIndexindex=newIndex(indexFolder);// Indexing documents from the specified folderindex.Add(documentsFolder);// Creating a search options instanceSearchOptionsoptions=newSearchOptions();options.UseWordFormsSearch=true;// Enabling search for word forms// Searching in the indexSearchResultresult=index.Search("relative",options);// The following words can be found:// relative// relatives// relatively
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: