lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Simpson <simps...@gmail.com>
Subject Re: Query with phrases, wildcards and fuzziness
Date Wed, 22 May 2013 01:46:12 GMT
Jack, thanks very much!  I wasn't considering a space a special character for some reason.
 That has worked perfectly.

Cheers,
Ross


On May 22, 2013, at 10:24 AM, Jack Krupansky wrote:

> Just escape embedded spaces with a backslash.
> 
> -- Jack Krupansky
> 
> -----Original Message----- From: Ross Simpson
> Sent: Tuesday, May 21, 2013 8:08 PM
> To: java-user@lucene.apache.org
> Subject: Query with phrases, wildcards and fuzziness
> 
> Hi all,
> 
> I'm trying to create a fairly complex query, and having trouble constructing it.
> 
> My index contains a TextField with place names as strings, e.g.:
> Port Melbourne, VIC 3207
> 
> I'm using an analyzer with just KeywordTokenizer and LowerCaseFilter, so that my strings
are not tokenized at all.
> 
> I want to support end-user searches like the following, and have them match that string
above:
> Port Melbourne, VIC 3207 (exact)
> Port (prefix)
> Port Mel (prefix, including a space)
> Melbo (wildcard)
> Melburne (fuzzy)
> 
> I'm trying to get away with not parsing the query myself, and just constructing something
like this:
> parser.parse( "(STRING^9) OR (STRING*^7) OR (*STRING*^5) OR (STRING~1^3) );
> 
> That doesn't seem to work, neither with QueryParser nor with ComplexPhraseQueryParser.
 Specifically, I'm having trouble getting appropriate results when there's a space in the
input string, notable with the wildcard match part (it ends up returning everything in the
index).
> 
> Is my approach above possible?  I also have had a look at using specific Query implementations
and combining them in a BooleanQuery, but I'm not quite sure how to replicate the "OR" behavior
I want (from reading, Occur.SHOULD is not equivalent or "OR").
> 
> 
> Any suggestions would be appreciated.
> 
> Thanks!
> Ross
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 


---------------------------------------------------------------------
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