lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Default search to AND rather than OR
Date Thu, 18 May 2006 01:43:18 GMT
Owen,

Have a look at the QueryParser API.  setDefaultOperator :)

However, be aware that you need to construct an instance of  
QueryParser and use the instance parse(String) method and not the  
static parse(String,String,Analyzer) method.

	Erik


On May 17, 2006, at 9:04 PM, owen@aus wrote:

>
> I have users that want the search to work like google. So when a  
> user enters
> a query, such as:
>
> Tram Pole
>
> The result should be documents that contains both "tram" and  
> "pole". At the
> moment, the default seems to be documents that contain "tram" or  
> "pole".
> I thought of paring the query before I submit it to lucene and  
> place "AND"
> between each term but this would prevent the user from entering an  
> OR query
> (or any other lucene sytax!).
>
> So I'm stuck. I've been looking at the Analyzers but nothing seems  
> to do
> what I need. This seems such an obvious question that I'm betting that
> someone out there has just the right solution.
>
> Cheers,
> Owen.
> --
> View this message in context: http://www.nabble.com/Default-search- 
> to-AND-rather-than-OR-t1640214.html#a4442682
> Sent from the Lucene - Java Developer forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org


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


Mime
View raw message