lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bamford <chris.bamf...@scalix.com>
Subject Re: Search question (newbie)
Date Fri, 04 Jul 2008 12:09:37 GMT
John,

Thanks, I think I'm getting this now....  So you created your own 
BooleanQuery and parsed the string yourself, adding strings as  
TermQuerys etc., rather than using a QueryParser ?

Cheers,

- Chris

John Griffin wrote:
> Chris,
>
> 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
> docs). 
>
> 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 [mailto:chris.bamford@scalix.com] 
> Sent: Thursday, July 03, 2008 7:39 AM
> To: java-user@lucene.apache.org
> Subject: Search question (newbie)
>
> Hi,
>
> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>   


-- 
------------------------------------------------------------------------
*Chris Bamford*
Senior Development Engineer 	<http://www.scalix.com>
------------------------------------------------------------------------
/Email / MSN/ 	chris.bamford@scalix.com
/Tel/ 	+44 (0)1344 381814 	  	/Skype/ 	c.bamford


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