Forum: Ferret Questions on tokenized x untokenized and date sorting

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
21cf81c94ab6711c733bf629075582cc?d=identicon&s=25 Manoel Lemos (mlemos)
on 2007-03-28 22:55
Gents, does this definition will allow me to search inside title,
sub_title and url and sort by score, rank_sort, last_updated_at_sort ?

  acts_as_ferret  :fields => { :title => {:boost => 2, :store => :yes},
                              :sub_title => {:store => :yes},
                              :url => {:store => :yes},
                              :rank_sort => {:index => :untokenized},
                              :last_updated_at_sort => {:index =>
:untokenized_omit_norms, :term_vector => :no}},
                  :remote => true

  def rank_sort
    begin
      return self.rank_links.to_i
    rescue
      return nil
    end
  end

  def last_updated_at_sort
    begin
      self.last_updated_at.to_i
    rescue
      return nil
    end
  end
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-03-29 10:16
(Received via mailing list)
On Wed, Mar 28, 2007 at 10:55:07PM +0200, Manoel Lemos wrote:
> Gents, does this definition will allow me to search inside title,
> sub_title and url and sort by score, rank_sort, last_updated_at_sort ?

looks good. Be sure to specify :int as the sort type when you sort
by rank_sort or last_updated_at_sort, or left-pad the values to a fixed
length with '0'.

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@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
This topic is locked and can not be replied to.