Hello, is there a way to exclude duplicates of a field?

hi,
this is what i am trying to accomplish

Post.find_by_contents(“artist:#{session[:srchstring]}*”)

this returns to me all artist with the first letter of say ‘n’ is there
a way to not repeat valuse of the same artist?

thank you so much for the help./

On Mon, Jun 25, 2007 at 04:35:43AM +0200, sarah wrote:

hi,
this is what i am trying to accomplish

Post.find_by_contents(“artist:#{session[:srchstring]}*”)

this returns to me all artist with the first letter of say ‘n’ is there
a way to not repeat valuse of the same artist?

Not with Ferret alone. But if you combined Ferret with a custom active
record query this should be doable. Check out find_id_by_contents which
only gets the id values from ferret, and then use these to query your
unique artists.

find_id_by_contents is used internally by find_by_contents, too, so you
can have a look at the implementation to see how it is used.

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