On Thu, Mar 01, 2007 at 09:01:51PM +0100, Mischa Berger wrote:
> Thanks Jens,
>
> I really appreciate your help.
>
> > no, the find_options are only used when fetching the results via active
> > record.
> >
> > If you indexed the customer_id field you could just append
> > "+customer_id:#{normalize(@customer.id)}" to the ferret query string.
>
> I have a few more questions.
>
> At the moment I am indexing the customer_id too. Which one of these two
> option would be better performance-wise?
If there is exactly one customer per document, having the customer_id
indexed would be better. However the find_options are useful e.g. when
you have to do joins to select records a client may see.
> > (normalize should be a function that pads the customer id to a fixed
> > length string)
>
> Why is it needed to pad the customer id to a fixed length string? I
> tried it without the padding and that seems to work. In case it's better
> to do the padding; should I find the id with the longest length and add
> spaces in front if the length of the customer_id I'm searching for is
> smaller?
I'm not sure about the normalizing thing, possible you don't need it.
But the field has to be untokenized. Afair the padding was only needed
in earlier versions of ferret for sorting by fields with numeric
contents - even there it's not needed any more.
cheers,
Jens
--
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk