Developer Forum »
IndexQuery with hyphen
62 posts

This is a narrow question.. but I have a very simple IndexQuery with NameSearch.

search.NameSearch = s + "*";

I have noticed that when I search for a node with hyphen, it is interpreted as minus, and therefore excluded from the search result. When searching in Google, you would add space before - in order to exclude something. If I remove the * it seems to work, but I'd like to keep *.

Anyone with a quick workaround for this little problem?

120 posts

Lucene StandardAnalyzer will treat the hyphen as whitespace I think. So you could replace "-" with " ", it should work :)

1