views:

179

answers:

1

How to make Lucene.NET Query '#' and '+' characters ?

Like "C#" and "C++"

Note : i use NHibernate.Search

A: 

This will work, it all depends upon how your index is built. does your analyzer throw away these symbols? It also depends upon how the query is getting built, it all boils down to what Terms are getting indexed and what Terms you are searching with.

If you are using the QueryParser to create the lucene Query object, you will have to escape special characters such as the + by adding a \ in front of it.

example:

string query = @"2\+2";
Andrew Smith