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.

Reply via email to