Here are the main reasons for using the new updated API provided by GroupDocs.Search for .NET from version 19.9:
Unified work with some similar entities to increase the intuitiveness of using API.
The architecture of the product has been revised and optimized, so that some functions will work faster.
Some entities have been renamed to improve code readability.
The changes made to the API are not too significant, so the migration will not be too difficult.
New functionality will not be added to the old API version, only to the new version.
How To Migrate?
The following code examples demonstrate changes in the use of the API.
Old coding style:
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder=@"c:\MyDocuments\";// Creating an index in the specified folderIndexindex=newIndex(indexFolder);// Indexing documents from the specified folderindex.AddToIndex(documentsFolder);// Creating a search parameters objectSearchParametersparameters=newSearchParameters();parameters.FuzzySearch.Enabled=true;// Enabling the fuzzy searchparameters.FuzzySearch.FuzzyAlgorithm=newTableDiscreteFunction(2);// Setting the number of possible differences for each word// Searching in the indexSearchResultsresults=index.Search("Happiness",parameters);if(results.Count>0){// Generating HTML-formatted text of a document with highlighted search resultsindex.HighlightInText(@"c:\Highlighted.html",results[0]);}
New coding style:
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 objectSearchOptionsoptions=newSearchOptions();options.FuzzySearch.Enabled=true;// Enabling the fuzzy searchoptions.FuzzySearch.FuzzyAlgorithm=newTableDiscreteFunction(2);// Setting the number of possible differences for each word// Searching in the indexSearchResultresult=index.Search("Happiness",options);if(result.DocumentCount>0){// Generating HTML-formatted text of a document with highlighted search resultsindex.Highlight(result.GetFoundDocument(0),newHtmlHighlighter(newFileOutputAdapter(@"c:\Highlighted.html")));}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.