Jesse wrote:
> Actually, I think the most direct approach is to weight the field by
> briefest length of description.  So "carrots, raw" always comes up
> before "babyfoods, carrots" for query='carrots'.  of course
> query='babyfoods carrots' should turn up the latter before "carrots,
> raw".

You could create an attribute that contains the length of the name and
sort by that.

In your define_index block:

  has "length(`name`)", :as => :name_legth, :type => :integer

then use :order => :name_length in your search options.

-- James Healy <jimmy-at-deefa-dot-com>  Mon, 20 Oct 2008 10:29:43 +1100

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to