c# - Lucene .Net term query with special character -
I am searching for something that corresponds exactly to the phrase. After research, I thought most of Good way to set the area to NOT_ANALYSED
and execute TermQuery
.
This works fine but when a word is a special character, like "/" there are no results, I can see the use of Luke that there is a character in the field. I create my query like this .
Boolean filter filterQuery = new boolean (); FilterQuery.Add (New TermQuery (New Lucene.Net.Index.Term (customFieldFilter.Name, val)), MUST); BooleanQuery.Add (filtered, occur.must);
The last question looks like this:
{+ type: person + (+ expertise: customer service / account management)}
< / Pre>The API mentioned that "/" is a special character, so I tried to avoid it
val = val.Replace ("/", "\\ / "); {+ Type: person + (+ specialization: customer service / account management)}
But there are still no results. Search without special characters is OK, why do I need to change?
Not sure about C #, but Java Lucene, Forward Slash ( / < / Code>). The backward slash (
\
), however, is.
What you have done with your code, you have used the escape slash to avoid a symbol that does not need to be saved. There should be no difference against the initial code, so the result is getting you.
To answer fully your question, if you can show how exactly you are indexed text, a small, self-centered example showing this problem will be ideal .
Comments
Post a Comment