I'd like to add something if you're doing facet search across MVAs. I've done 
exactly this (I've saved a materialized path from a product's category tree ... 
so something like parent,parent2,child) and here's two issues you need to be 
aware of:

1) Sphinx sorts MVAs. This means that if the order of the single numbers is 
important (i.e. "1,2,3" is different from "2,1,3") you might get unexpected 
results.
2) As far as I've experienced, Thinking Sphinx doesn't split this kind of MVA 
automatically. If you have a separate table, TS will automatically sum up 
facets correctly but it doesn't seem to do so for "manual MVAs" (for lack of a 
better term).

This could, of course, also stem from me not using it correctly, but if you're 
having issues maybe this is the place to start looking. :)

- C.

Clemens Kofler
http://www.railway.at
[email protected]

railway - welcome aboard!

On Mar 7, 2011, at 10:40 AM, Pat Allan wrote:

> Ah, right. Add the following within your define_index block:
>  group_by 'sales.numbers'
> 
> Give that a spin :)
> 
> -- 
> Pat
> 
> On 07/03/2011, at 8:00 PM, Kyle Murphy wrote:
> 
>> Thanks Pat.
>> 
>> I'm using postgresql and going with the REPLACE option (because I
>> realized I need to replace another character as well) gives me this
>> error (Sale is my model):
>> 
>> ERROR: index 'sale_core': sql_range_query: ERROR:  column
>> "sales.numbers" must appear in the GROUP BY clause or be used in an
>> aggregate function
>> 
>> On Mar 4, 4:23 pm, Pat Allan <[email protected]> wrote:
>>> Hi Kyle
>>> 
>>> Sphinx expects comma delimited values, not sure how it handles spaces - but 
>>> you can give it a shot.
>>> 
>>> First, just try defining the attribute with an explicit type:
>>>  has numbers, :type => :multi
>>> 
>>> If that doesn't work (TS may still be making assumptions):
>>>  has 'numbers', :as => :numbers, :type => :multi
>>> 
>>> And finally, if Sphinx chokes on the spaces:
>>>  has "REPLACE(numbers, ' ', '')", :as => :numbers, :type => :multi
>>> 
>>> And it's nice to see REPLACE exists in both MySQL and PostgreSQL :)
>>> 
>>> Cheers
>>> 
>>> --
>>> Pat
>>> 
>>> On 04/03/2011, at 10:38 PM, Kyle Murphy wrote:
>>> 
>>> 
>>> 
>>>> One field in my model looks like this: "123, 456, 789"  (or any
>>>> number).  Could I index those numbers as MVAs on my model?
>>> 
>>>> Which might look like:
>>> 
>>>> define_indexes do
>>>> ...
>>>> has numbers => self.numbers.split(", ")
>>>> end
>>> 
>>>> Or something like that?  Hopefully that makes sense.
>>> 
>>>> Thank you for any help.
>>> 
>>>> --
>>>> 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.
> 

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