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 <jturn...@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-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org