Hello,
I am indexing tags such as Java, C++, C#, elastic-search, etc. When I enter a tag name, I need to check if it already exists. I want this operation to be case insensitive, so if I type c++ and there is a document with name C++ I want to get the existing document. To do so, I am using a text query:
return GetClient().Search(s => s
.Query(q => q
.Text(t => t
.OnField("name")
.QueryString(tagName.ToLower())
)
)
).Documents.SingleOrDefault();
But this ignores the special characters, and I get an exception when I search for C++, for example (it returns me c, C#, C++, C$, and so on).
I tried to use the TextQueryDescriptor.Analyzer() but it accepts a string as a parameter, so I tried the existing analyzers from elastic search such as "simple", "whitespace", "keyword" and "not_analyzed" but none of them worked. Some of them returned all tags starting with C, ignoring special characters, and others didn't return anything.
I don't know a lot about Analyzers, Tokenizers and Token Filters, but I believe there is a way of combining them to get what I need, that is a text query that is case insensitive but that doesn't ignore special characters. I don't know if this qualifies as an issue and I am sorry to open so many issues in the last days, but if there is a way of performing such query using NEST I would really appreciate if someone told me how.
Thanks in advance.