2

Search isn't working as expected.

  1. When I search for a word like "subjective", I'm getting cases with that word, but also ones with "subject".
  2. When I try to search for a partial match, I don't always get everything I would expect. For example, searching for "subject*" only returns "subjective" but not "subject".

How do I use wildcards in search axes for partial matches? Why am I getting other similar words returned?

flag

1 Answer

2

This is due to stemming, which is a common search engine practice. It reduces the size of the index, and deals with things like plurals very efficiently.

Basically, if I search for:

drunkard

I (probably) get results for

drunk
drunken
drunkenness

Because the search has been stemmed, and so has the index.

But wildcards turn off stemming, so if I want only results for "drunkard", I search for:

drunka*

But there's a bug (I think) where that splat is equivalent to POSIX .+ rather than .* This means that * requires there be at least one character after "drunka" instead of 0 or more characters, matching "drunka" or "drunkard" or "drunkatronic"

link|flag
Can you tell from my answer that it's Friday afternoon? – Rich Armstrong Jun 11 2010 at 18:26
Can this stemming feature (and how to circumvent it) be documented more clearly? If I search for a word I would expect exact matches only... – Michel de Ruiter Jun 11 2010 at 21:27
This is standard practice for all modern search engines. It's what you get when you search on Google, eBay, pretty much anything. – Rich Armstrong Jun 14 2010 at 14:32
1 
@Rich: for Google, I can circumvent stemming and all using +"whatever", could you please implement some workaround like that? Currently, I cannot search for words like a and or... – Michel de Ruiter Jan 13 2011 at 11:00
1 
@Michel Sorry, we're limited by what Lucene can do at this point. – Rich Armstrong Jan 13 2011 at 15:04
show 3 more comments

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.