lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: wildcard search constraints?
Date Fri, 17 Feb 2006 21:39:18 GMT
: I have some strange behaviors:
: (1) The field query slug:abc*hurr2* works only if the field type is
: "Keyword". The query fails if the type is "Text".
: (2) On the other hand, query slug:abc-nws-hurr29 only works if the field
: type is "Text" and fails if the type is "Keyword"

I think the problems you are seeing can be explain thusly:

  1) field type Text results in your analyzer (in this case
StandardAnalyzer) splitting the text on hyphens, or maybe it's just
pulling the numbers off, i don't acctually remember exactly what
StandardAnalyzer does, but when looking at your terms in luke you probaly
won't see "abc-nws-hurr29"

  2) regardless of how you index yourfield, QueryParser is going to pass
any text you give it to the analyzer (i'm guessing that again you are
using StanardAnalyzer in your QueryParser) which will again split on
hyphens (or maybe numbers) and this won't match your Keyword field (which
contains the literal value "abc-nws-hurr29"

: Do I have to use other Analyzer in order to have a correct wildcard search
: on different types of fields?

The tricky thing about wildcard searches in QueryParser is that QP can't
analyze your search input because of the wildcard tokens, so you have to
be very carefull in picking which analyzer you use for the fields you want
to do wildcard searching on.

Make sure you take a look at the PerFieldAnalyzerWrapper ... it will let
you use different analyzers for different fields.


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

View raw message