lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Wildcard and Literal Searches combined
Date Wed, 25 Jun 2008 21:21:07 GMT

: My users require wildcard searches. Sometimes their search phrases contain
: spaces. I am having trouble trying to implement a wildcard search on strings
: containing spaces, so if the term includes spaces I force a literal search
: by adding double quotes to the search term.
: So the search string for 'Dublin' becomes search term (Dublin*)
: whereas search string 'Dublin City' becomes ("Dublin City")

: If I use (Dublin City*) I get all instances of Dublin OR City in the results
: which is not what I am looking for. 

my naive understanding of your problem makes me think you should 
completely avoid using the QueryParser.  Index this field as "UNTOKENIZED" 
(or using an Analyzer that does no tokenization, but perhaps lowercases if 
that's what you want) and at query time construct a WildCardQuery directly 
off of the users input (lowercases first if that what you did at index 
time)

...but i could be missunderstanding your goal.


-Hoss


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


Mime
View raw message