On Fri, Sep 29, 2006 at 07:18:25AM -0400, Vince Puzzella
wrote:> New to this, but can''t you do something like:
>
> your_index.search(''id:1|2|3|4|5|6|7'')
that would result in the huge ''or'' query mentioned :-)
however, in that special case a range query would be more
appropriate: ''id:[1 7]''
with acts_as_ferret, you can also limit the result set on the
active_record side of things, by giving a standard AR conditions
argument:
find_by_contents(''query'', {}, :conditions => [''in
in (?)'', id_array])
Note that this makes ferret''s limit and offset parameters useless, as
the ar conditions further limit the resultset found in the ferret index.
Usually this is intended to be used on fields that aren''t in the ferret
index or are easier to query via the DB.
In your case I''d go for the or query approach, maybe you can even
optimize them to some range queries.
Jens
>
> On 9/29/06 1:20 AM, "Winton" <wintonius at gmail.com>
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
>
>
> _______________________________________________
> Ferret-talk mailing list
> Ferret-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ferret-talk
--
webit! Gesellschaft f?r neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de
Schnorrstra?e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66