lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Condit <>
Subject Re: Can't perform exact match...?
Date Fri, 15 Apr 2011 16:08:18 GMT
On 4/11/2011 1:47 AM, Chris Mantle wrote:
> Hi, I’m having some trouble with Lucene at the moment. I have a number of unique identifiers
that I need to search through. They’re in many different forms, eg. “M”, “MO”, “:MOFB”,
“FH..L-O”, etc. All I need to do is an exact prefix search: at the moment, if I type in
‘M’, I get “M”, “MO” and “:MOFB”, and I’d like to avoid getting “:MOFB”
until the user actually types in ‘:M’.
> This is with a StandardAnalyzer and a PrefixQuery. I’ve tried many different combinations
of analyzer and query. If I use a WhitespaceAnalyzer or a KeywordAnalyzer, I see that tokens
are generated in a form that I’d expect (“:MOFB” instead of “mofb”, for instance),
but I can’t search with a wildcard: searching with ‘M*’ returns nothing; ‘M’ returns
“M” alone. I’ve also tried using ANALYSED and NOT_ANALYSED indexing to no avail.
> Can anyone advise me on how to remedy this? There must be something I’m missing here...

I'm not sure why the WhitespaceAnalyzer isn't working for you (perhaps
someone else knows), but here's one that does:

I just wrapped a WhitespaceTokenizer in a LowerCaseFilter and it has the
desired effect.

Good luck,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message