lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Roberts <m...@andy-roberts.net>
Subject Re: Escaping special characters
Date Thu, 07 Apr 2005 09:16:58 GMT
On Thursday 07 Apr 2005 06:38, Chuck Williams wrote:
> Mufaddal Khumri writes (4/6/2005 11:21 PM):
> >Hi,
> >
> >Am new to Lucene. I found the following page:
> >http://lucene.apache.org/java/docs/queryparsersyntax.html. At the bottom
> >of the page there is a section that in order to escape special
> >characters one would use "\".
> >
> >
> >
> >I have an Indexer that indexes product names. Some product names have
> >"-" character in them. When I use my search class to search for product
> >names with - in them it wont find those products.
>
> How did you index those product names?  I.e., if you used a tokenized
> field for the product names and an analyzer that breaks on the hyphens,
> then there are no hyphenated tokens for you to match.  I would suggest
> using Luke to browse your index and see what you have.
>
> Chuck

The Lucene In Action book has an excellent chapter on Analysers - well worth a 
read. Of particular interest is some code that allows you to see how a given 
Analyser tokenises an input string.

You can download the source code from the book 
(http://www.lucenebook.com/LuceneInAction.zip). If you unzip this file you 
will find a directory called "LuceneInAction/src/lia/analysis" and in there 
is a class called AnalyzerDemo (which depends in AnalyzerUtils). Compile this 
and run to see how the Analysers work. Put in your hyphenated strings to see 
how they work too.

HTH
Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message