Hi David

Not seeing anything that *exactly* relates to the error you are seeing, but 
given you're using PostgreSQL, any columns that aren't aggregated and are used 
in SQL snippets will need to be grouped by - so, this means lat, lng, status 
and uploaded_as.

So, try adding this to the define_index block somewhere:

  group_by 'lat', 'lng', 'status', 'uploaded_as'

Does that help things at all?

-- 
Pat

On 30/08/2011, at 9:01 PM, David Krmpotic wrote:

> Hi Pat,
> 
>  define_index do
>    indexes :name, company, description, street, loc_info, zip, city,
> services, tags, hidden, internal, country
> 
>    has 'RADIANS(lat)', :as => :lat, :type => :float
>    has 'RADIANS(lng)', :as => :lng, :type => :float
> 
>    # sphinx converts string attributes to integers internally, but we
> don't know to what...
>    # to be able to filter on these values we need a (known) integer
> hash function
>    # and since psql doesn't support CRC32, we invent one - it's
> basically first 8 integer digits from md5 hash of the field
>    has "cast(substring(translate(md5(status), 'abcdef', '') from 1
> for 8) as integer)", :as => :status_hash, :type => :integer
>    has "cast(substring(translate(md5(uploaded_as), 'abcdef', '') from
> 1 for 8) as integer)", :as => :uploaded_as_hash, :type => :integer
>    has :wifi
>    has :student_coupon
>    has :has_active_deal
> 
>    set_property :field_weights => {'name' => 50, 'company' => 1000,
> 'city' => 80}
>    set_property :delta => true
>  end
> 
> 
> Postgresql: 8.4.0
> TS: 1.3.2
> 
> I ment normal associated model..
> 
> Thank you!
> david
> 
> On Aug 27, 5:11 am, Pat Allan <[email protected]> wrote:
>> Hi David
>> 
>> Is there anything else in the define_index block? And which versions of 
>> Thinking Sphinx and PostgreSQL are you using?
>> 
>> Also: when you say submodel, do you mean associated model? Or is there some 
>> inheritance as part of all of this?
>> 
>> Cheers
>> 
>> --
>> Pat
>> 
>> On 25/08/2011, at 7:13 PM, David Krmpotic wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hello,
>> 
>>> I have a problem with indexing a submodel attribute.
>> 
>>> class Spot < ...
>>>  has_many :deals
>> 
>>>  define_index do
>>>    indexes :name, company, description
>>>    indexes deals.title, :as => :deal
>>>  end
>>> end
>> 
>>> I get this: ERROR: index 'spot_core': sql_range_query: ERROR:  column
>>> "spots.id" must appear in the GROUP BY clause or be used in an
>>> aggregate function
>>> LINE 1: SELECT "spots"."id" * 2 + 1 AS "id" , "spots"."name" AS
>>> "nam...
>> 
>>> I'm using Postgres.
>> 
>>> The error disappears when I remove indexes deals.title, :as => :deal
>> 
>>> Can you please help?
>>> Thank you!
>> 
>>> David
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Thinking Sphinx" group.> To post to this group, send email 
>>> [email protected].> To unsubscribe from this group, send 
>>> email [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