Hi Guys
I''m experiencing with AAF and Ferret with the intention of deploying
into the site that I am working on now.
So I setup AAF to index 3 fields that I have in this model and i tried
doing a find_by_contents and it returned the
#<FerretMixin::Acts::ARFerret::SearchResults:0xb74b5bec
@total_hits=1157, @results=[#<Payprofile:0xb74cc39c
@attributes={"add......
but it seems that there is no way to access the result set... I read
somewhere that it''s not implement yet.. So any knows when the release
will be. and until there is there any workaround for this.
I know that you can do a find_by_contents_id, but that returns the model
id set, and then you need to build the result set from the id.
Thanks for any advice!
Rgds
Alfred Toh
Payscroll.com
--
Posted via http://www.ruby-forum.com/.
Ok.. after digging more into acts_as_ferret.rb, I realize I can add an
attr_accessor for @results
Any reason/problem that I shouldn''t be doing that that since it was not
left out in the latest release?
Another problem I''m having now is to sort the result by using the
find_options
find_options is a hash passed on to active_record?s find when retrieving
the data from db, useful to i.e. prefetch relationships.
but I wasn''t able to get it to work with :order by doing this...
moto=Pay.find_by_contents("motorola",:limit=>:all,:order=>"salary
DESC")
anyone has similar problems too? thanks for helping!
Rgds
Alfred Toh
Payscroll.com
Alfred Toh wrote:> Hi Guys
>
> I''m experiencing with AAF and Ferret with the intention of
deploying
> into the site that I am working on now.
>
> So I setup AAF to index 3 fields that I have in this model and i tried
> doing a find_by_contents and it returned the
>
> #<FerretMixin::Acts::ARFerret::SearchResults:0xb74b5bec
> @total_hits=1157, @results=[#<Payprofile:0xb74cc39c
> @attributes={"add......
>
> but it seems that there is no way to access the result set... I read
> somewhere that it''s not implement yet.. So any knows when the
release
> will be. and until there is there any workaround for this.
>
> I know that you can do a find_by_contents_id, but that returns the model
> id set, and then you need to build the result set from the id.
>
> Thanks for any advice!
>
> Rgds
> Alfred Toh
> Payscroll.com
--
Posted via http://www.ruby-forum.com/.
Hi! On Sat, Oct 21, 2006 at 07:11:00PM +0200, Alfred Toh wrote:> Ok.. after digging more into acts_as_ferret.rb, I realize I can add an > attr_accessor for @results > > Any reason/problem that I shouldn''t be doing that that since it was not > left out in the latest release?There''s no need to do this, as the SearchResults class hands through all method calls to @results by overriding method_missing. Just use the SearchResults instance as you would use an array.> Another problem I''m having now is to sort the result by using the > find_options > > find_options is a hash passed on to active_record?s find when retrieving > the data from db, useful to i.e. prefetch relationships. > > but I wasn''t able to get it to work with :order by doing this... > > moto=Pay.find_by_contents("motorola",:limit=>:all,:order=>"salary DESC")try moto=Pay.find_by_contents("motorola",{},{ :limit=>:all,:order=>"salary DESC" }) there''s two optional hash arguments to find_by_contents, the first one being ferret_options, and the second one the find_options. As this problem arises quite often, I start thinking about merging them together into one in future versions. cheers, Jens -- 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