Jens Kraemer wrote:
> On Fri, Jul 13, 2007 at 05:14:22PM +0200, Mike Mangino wrote:
>> >> index now.
>> 
>> 
>> DRb::DRbConnError: DRb::DRbServerNotFound
>> 
>> 
>> Is there an easy fix for this?
> 
> Do you already use acts_as_ferret's trunk?
> 
> If yes and this problem still exists, your best bet is to extend
> local_index.rb and add a custom search method that constructs your sort
> objects based on additional parameters (that are no sort objects, to
> avoid the drb probs) you hand it over. This method will be then
> reachable via the ferret_index property of your model class.
> 

Okay. I did this previously. Here is my change:

    def find_id_by_contents(query, options = {})
      if  (sort=options[:sort])
        sort = [sort] unless sort.is_a?(Array)
        sort_fields = sort.map do |field|
          term,direction,sort_type = field.split(/\s+/)
          direction ||= "asc"
          sort_type ||= "auto"
          
Ferret::Search::SortField.new(term,:reverse=>direction.match(/desc/i),:type=>sort_type.to_sym)
        end
        options[:sort]=Ferret::Search::Sort.new(sort_fields)
      end
      ...

That fixes the sort ordering and allows you to specify the type in the 
sort.

I can roll that up into a patch if you would like that for inclusion.

Mike


> 
> 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


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to