lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Griffin" <>
Subject RE: Search question (newbie)
Date Thu, 03 Jul 2008 21:43:19 GMT

I've had similar requirements in the past. First strip the quotes then
create a BooleanQuery consisting of two separate queries.

1. TermQuery for the first term - Fred
2. PrefixQuery for the second term - Flintstone

When you add each individual query to the BooleanQuery make sure the
BooleanClause.Occur parameter is set to MUST (look at the BooleanQuery API

Use the toString() method on the BooleanQuery after it's created to make
sure you did it correctly.

John G.

-----Original Message-----
From: Chris Bamford [] 
Sent: Thursday, July 03, 2008 7:39 AM
Subject: Search question (newbie)


Can someone point me in the right direction please?
How can I trap this situation correctly?  I receive user queries like 
this (quotes included):

    /from:"fred flintston*"/

Which produces a query string of

    /+from:fred  body:flintston/       (where /body/ is the default field)

What I want is:

/    +from:fred +from:flintston*/

In other words, I want quoted expressions to be treated as single units..
Thanks for any pointers,

- Chris

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

View raw message