You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sam Giffney <sa...@gmail.com> on 2006/08/21 01:17:08 UTC

Apostrophe S ('s)

Using the Standard Analyzer the string
McDonald's
is indexed with the term
mcdonald

so it will be found by a (QueryParser parsed) query for
McDonald
or
McDonald's
but not
McDonalds

Wikipedia (who uses lucene) says on
http://en.wikipedia.org/wiki/Wikipedia:Searching

An apostrophe is identical to a single quote, therefore Mu'ammar can
be found searching for exactly that (and not otherwise). A word with
apostrophe s is an exception in that it can be found also searching
for the word without the apostrophe and the s.

Is this a custom parser?
How can one achieve this same exception most easily?

Sam

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


Re: Apostrophe S ('s)

Posted by Daniel Noll <da...@nuix.com.au>.
Sam Giffney wrote:
> Using the Standard Analyzer the string
> McDonald's
> is indexed with the term
> mcdonald
> 
> so it will be found by a (QueryParser parsed) query for
> McDonald
> or
> McDonald's
> but not
> McDonalds
> 
> Wikipedia (who uses lucene) says on
> http://en.wikipedia.org/wiki/Wikipedia:Searching
> 
> An apostrophe is identical to a single quote, therefore Mu'ammar can
> be found searching for exactly that (and not otherwise). A word with
> apostrophe s is an exception in that it can be found also searching
> for the word without the apostrophe and the s.
> 
> Is this a custom parser?

Following Wikipedia's explanation, McDonald's -> McDonald, by removing 
the apostrophe *AND* the s.  That text you quoted doesn't say that you 
can omit the apostrophe while leaving in the s, so my guess is they're 
using the exact same analyser.

In any case, have you tried using stemming?  Stemming would convert 
"mcdonalds" -> "mcdonald" so that both work.

Daniel

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