Search code examples
azureazure-cognitive-search

Azure Cognitive search customization


I am customizing Azure Cognitive Search and want to prevent certain custom stop words from being searched.

I updated the TokenFilters property in the AnalyzeTextOptions class to this:

TokenFilters = { ConstantAsciiFoldingName, TokenFilterName.Lowercase, Constants.StopwordsName, TokenFilterName.Stopwords };

My goal is to allow searches for inbuilt stop words like "the" or "if" while still excluding other custom stop words. However, this configuration seems to apply both the custom and built-in stop words, and I can't figure out how to isolate the two.

What I’ve tried: I have tried removing the TokenFilterName.Stopwords property

Expected result: Allow searches for "the" and "if" while excluding custom stop words.


Solution

  • I was able to fix this, by listing all the built in stopwords in the custom stopwords then excluding if , that way I was able to search "if" and "the" without loading the search analyzer with the built in stop words