lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Devon H. O'Dell" <devon.od...@gmail.com>
Subject Re: How to ignore apostrophes in indexes and queries?
Date Mon, 12 Sep 2011 14:18:19 GMT
One way to do this is to create an Analyzer and Tokenizer that are
used on both index and search side. In the tokenStream method, you
return a new normalizing tokenizer; in the Tokenizer, you override the
normalize method to ignore apostrophes.

--dho

2011/9/12 SBS <jturnbul@uow.edu.au>:
> In out situation we need it so that searches containing apostrophes and those
> not containing apostrophes yield identical results for content that contains
> apostrophes.  We also need it so that the content is still stored with the
> apostrophes present and so that the highlighter indicates that the word(s)
> that need to be highlighted in the displayed content do contain the
> apostrophes.
>
> So for example, if the content looked something like:
>
> /*onset of Alzheimer's disease*/
>
> then identical results would be returned for a query of /*alzheimers*/ and
> for a query of /*alzheimer's*/ and in both cases the highlighter would
> indicate that the word /*Alzheimer's*/ needs to be highlighted in the
> displayed content.
>
> Is this possible?  What's the best way to achieve this?  I am using Lucene
> 3.2 with StandardAnalyzer and QueryParser at present.
>
> Thanks,
>
> -sbs
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-ignore-apostrophes-in-indexes-and-queries-tp3328638p3328638.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
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