Hi Kyle
It's not that the attributes have values of 5, that's just the indication of
the data type. Attribute values will be returned for each hash/result in
:matches - but you're getting nothing.
Firstly, I'd recommend trying with a range from 0.0 to 200.0 - there's no need
to use negative values, it's all just distance from the specified point. If
that doesn't help, let us know.
--
Pat
On 31/12/2009, at 9:57 AM, Kyle Murph wrote:
> Thank you, that fixed the error. I still can't seem to get it working
> though -- can you tell me what I'm doing wrong?
>
> i have an entry in my db; lng and lat are set to 1 and 2
>
> in sphinx.conf i have:
> sql_attr_float = lat
> sql_attr_float = lng
>
> here's my attempt to get it working
>
> client.sort_by = '@geodist ASC, @weight DESC'
> client.sort_mode = :extended
> client.set_anchor('lat', -0.6591741, 'lng', 2.530770)
> client.filters << Riddle::Client::Filter.new("@geodist",
> -200.0..200.0, false) # wide range for testing, passing 'geodist'
> without '@' in front of it returns an error when i query
>
>> client.query "hey"
> => {:status=>0, :total=>0, :attributes=>{"lng"=>5, "@geodist"=>5,
> "lat"=>5}, :matches=>[], :total_found=>0, :fields=>["id", "fullname",
> "profile", "birthdate", "gender", "zip", "user_email", "id", "city",
> "country_code", "state", "zip", "user_email"], :words=>{"hey"=>
> {:docs=>1, :hits=>1}}, :time=>0.001, :attribute_names=>["lng", "lat",
> "@geodist"]}
>
> Any idea why all of the attributes have values of 5? What am I doing
> wrong?
>
> Thanks again.
>
> On Dec 26, 4:57 pm, Pat Allan <[email protected]> wrote:
>> Hi Kyle
>>
>> You'll need to set a value for :sort_by as well - for example:
>>
>> client.sort_by = '@geodist ASC, @weight DESC'
>>
>> I'm pretty sure this is what's causing the error. That said, you shouldn't
>> need to use the expression sorting mode - but you do need a reference to
>> @geodist in your sorting or filters for geo searching to come into play. So
>> alternatively, you can use the :extended sort mode (not sure if there's
>> going to be any noticeable speed difference between that and :expr though).
>>
>> --
>> Pat
>>
>> On 27/12/2009, at 4:55 AM, Kyle Murph wrote:
>>
>>> Sorry for the somewhat OT thread here, but I'm using Riddle with
>>> Sinatra, trying to get GeoDist working, and I'm thoroughly confused.
>>
>>> I can get Riddle up and running, and do basic :extended match_mode
>>> searches. It seems I need to use PH_SORT_EXPR for GeoDist, but I
>>> can't seem to get it working.
>>
>>> Here's my terminal session:
>>
>>>> client.sort_mode = :expr
>>>> client.query "hey"
>>> => {:status=>1, :attributes=>{}, :matches=>[], :fields=>
>>> [], :error=>"index test2: syntax error, unexpected $end near
>>> ''", :words=>{}, :attribute_names=>[]}
>>
>>> Am I doing something wrong? Any kind of query causes the same error
>>> after setting sort_mode to :expr.
>>
>>> Any help is greatly appreciated.
>>
>>> --
>>
>>> 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.
>
> On Dec 26, 4:57 pm, Pat Allan <[email protected]> wrote:
>> Hi Kyle
>>
>> You'll need to set a value for :sort_by as well - for example:
>>
>> client.sort_by = '@geodist ASC, @weight DESC'
>>
>> I'm pretty sure this is what's causing the error. That said, you shouldn't
>> need to use the expression sorting mode - but you do need a reference to
>> @geodist in your sorting or filters for geo searching to come into play. So
>> alternatively, you can use the :extended sort mode (not sure if there's
>> going to be any noticeable speed difference between that and :expr though).
>>
>> --
>> Pat
>>
>> On 27/12/2009, at 4:55 AM, Kyle Murph wrote:
>>
>>> Sorry for the somewhat OT thread here, but I'm using Riddle with
>>> Sinatra, trying to get GeoDist working, and I'm thoroughly confused.
>>
>>> I can get Riddle up and running, and do basic :extended match_mode
>>> searches. It seems I need to use PH_SORT_EXPR for GeoDist, but I
>>> can't seem to get it working.
>>
>>> Here's my terminal session:
>>
>>>> client.sort_mode = :expr
>>>> client.query "hey"
>>> => {:status=>1, :attributes=>{}, :matches=>[], :fields=>
>>> [], :error=>"index test2: syntax error, unexpected $end near
>>> ''", :words=>{}, :attribute_names=>[]}
>>
>>> Am I doing something wrong? Any kind of query causes the same error
>>> after setting sort_mode to :expr.
>>
>>> Any help is greatly appreciated.
>>
>>> --
>>
>>> 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.