On Mon, Nov 05, 2007 at 11:09:28AM +0100, Hongli Lai wrote:
> Scott Davies wrote:
> > It's trivial if you construct your query tree manually, which you'll
> > probably have to do for your security purposes (as opposed to using
> > one of the existing query parsers)...the first argument to TermQuery's
> > constructor is which field to search.
> 
> I found out that I'll need a query that looks like this:
> 
> "(group_id:#{group_id} AND private_content:#{search_term}) OR 
> (public_content:#{search_term})"
> 
> The query parser seems to generate a BooleanQuery at the top-level. I 
> spent several hours reading the book and the API, but I could not find a 
> way to generate 'OR' boolean queries. The API only allows :must, 
> :must_not and :should. How can I construct an OR query like the one above?

Ferret by default creates OR queries so a query string like 
'term1 term2' means the same as 'term1 OR term2' .

Using the API, :should is the correct modifier to create ORed boolean
clauses.


Jens


-- 
Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/     - The new free film database
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to