I am searching for items that match a phrase exactly. After research I thought the best way to do this would be setting the field to NOT_ANALYSED
and performing a TermQuery
.
This works fine but when a term has a special character, such as "/" there are no results. I can see using Luke that the field contains the character. I construct my query like this.
BooleanQuery filterQuery = new BooleanQuery();
filterQuery.Add(new TermQuery(new Lucene.Net.Index.Term(customFieldFilter.Name, val)), Occur.MUST);
booleanQuery.Add(filterQuery, Occur.MUST);
The final query looks like this:
{+Type:Person +(+Expertise:Customer Care/Account Management)}
The API mentioned that "/" is a special character, so i tried to escape it
val = val.Replace("/", "\\/");
{+Type:Person +(+Expertise:Customer Care\/Account Management)}
But there are still no results. Searches without special characters are fine, What do i need to change?