No worries :)

-- 
Pat

On 11/08/2011, at 9:59 PM, mikeee wrote:

> Thanks Pat - this is perfect.
> 
> Thanks also for maintaining TS - it's fantastic.
> 
> Mike
> 
> On Aug 11, 2:17 am, Pat Allan <[email protected]> wrote:
>> Hi Mike
>> 
>> There's a couple of options - firstly, you can weight certain indices to 
>> have higher priorities in your search call:
>> 
>>   :index_weights => {Continent => 4, Country => 3, StateProvince => 2, Place 
>> => 1}
>> 
>> That won't ensure your order, though - if a country is a far better match 
>> than a low continent, then it'll probably end up above it. Could play with 
>> those numbers (any indices/classes not mentioned get a weight of 1), they 
>> don't need to be sequential, could be anything.
>> 
>> A more reliable option, if the ordering is critical, is give each model a 
>> manual attribute like so - changing the number each time to ensure your sort 
>> order:
>> 
>>   has '1', :as => :class_sort, :type => :integer
>> 
>> And then use :order => :class_sort - or, better: "class_sort ASC, @relevance 
>> DESC"
>> 
>> Cheers
>> 
>> --
>> Pat
>> 
>> On 11/08/2011, at 1:14 PM, mikeee wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi -
>> 
>>> I have a few models I'm indexing: Continent, Country, StateProvince
>>> and Place
>> 
>>> I'd like if possible to have the ranking/weight of these to be in the
>>> order I've listed above in the search results.   Is there any way to
>>> do this?
>> 
>>> I've tried using the :classes attribute but that doesn't seem to
>>> affect the ranking.
>> 
>>> Thanks for any advice.
>> 
>>> Mike
>> 
>>> --
>>> 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 
>>> athttp://groups.google.com/group/thinking-sphinx?hl=en.
> 
> -- 
> 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.
> 

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