sarah
2007-Jun-25 02:35 UTC
[Ferret-talk] 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./ -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2007-Jun-25 07:11 UTC
[Ferret-talk] hello, is there a way to exclude duplicates of a field?
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 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa