On 9/29/06, Winton <[EMAIL PROTECTED]> wrote:
> How would you go about searching only a specific set of IDs in
> acts_as_ferret? Should I just create a huge "or" query or is there a
> more stylish way?
>
> Thanks,
> Winton
>

That depends. If all the ids are in a certain range then you are best
off using a range query. If the are randomly distributed then you can
use an "or" query, although a MultiTermQuery would be better. To
specify it in Ferret Query Language just add the terms separated by a
"|". For example:

    index.search(query + ' id:"1257|8732|3428|2387"')

Or if the IDs are in an array you'd do it like this:

    index.search(query + ' id:"' + id_ary.join('|') + '"')

You could also build a filter but I don't think it would be worth it
in this case.

Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to