Hi Chaitanya
Firstly: you’re sending the zip code through as the search query, which is
probably why only the one artist is returned. If you want artists from other
zip codes, perhaps remove the query:
Artist.facets(92107,{:geo=>[0.5714378699136865, -2.046398109885709],
:latitude_attr=>"latitude", :longitude_attr=>"longitude",
:with=>{"@geodist"=>0.0..10000000000.0}, :sort=>"created_at",
:sort_mode=>"desc”})
# becomes
Artist.facets({:geo=>[0.5714378699136865, -2.046398109885709],
:latitude_attr=>"latitude", :longitude_attr=>"longitude",
:with=>{"@geodist"=>0.0..10000000000.0}, :sort=>"created_at",
:sort_mode=>"desc"})
You also don’t need to specify the lat/lng attributes, given you’re using
standard names.
Artist.facets({:geo=>[0.5714378699136865, -2.046398109885709],
:with=>{"@geodist"=>0.0..10000000000.0}, :sort=>"created_at",
:sort_mode=>"desc"})
As for the distance filter - geodist values are in metres, not kilometres or
miles, so that might explain why you need particularly large values to get
matching results back.
Hope this helps.
—
Pat
On 9 Dec 2013, at 5:21 am, Chaitanya Malla <[email protected]> wrote:
> All,
>
> I am pretty new to ThinkingSphnix, and I love it as how fast the searches
> are. But, I am having hard time trying to figure out how "geo" search works.
> I'm struggling to find the solutions since more than a week and end up
> (headbang) every time. Hope, I get some help on this:
>
> Indexing:
>
> ################# Indexing ################################
> define_index do
> indexes :professional_nickname, :as => :name, :sortable => true
> indexes :zip_code
> indexes :address
> indexes :city
> indexes :country
> indexes services(:name), :as => :service,:type => :string, :facet =>
> true
> has tattoo_styles(:id), :as => :tattoo_styles, :facet => :true
> has categories(:id), :as => :categories, :facet => :true
> indexes languages(:name), :as => :languages, :facet => true
> indexes specialities(:name), :as => :speciality, :type => :string, :facet
> => true
>
> has created_at
> has 'RADIANS(artists.lat)', :as => :latitude, :type => :float
> has 'RADIANS(artists.lon)', :as => :longitude, :type => :float
> where "artists.admin_approved = '1'"
> set_property :charset_table => "0..9, A..Z->a..z, _,
> a..z,U+410..U+42F->U+430..U+44F, U+430..U+44F"
> set_property :group_concat_max_len => 8192
> set_property :delta => true
> set_property :field_weights => {
> "name" => 100,
> "zip_code" => 70,
> "artist_services" => 60
> }
> end
>
> Search:
>
> Artist.facets(92107,{:geo=>[0.5714378699136865, -2.046398109885709],
> :latitude_attr=>"latitude", :longitude_attr=>"longitude",
> :with=>{"@geodist"=>0.0..10000000000.0}, :sort=>"created_at",
> :sort_mode=>"desc"}) #returns only 1 artist that is from 92107 zipcode. I
> have others artist from 92110 and 92154.
>
> Also, I need to give @geodist value very high inorder to retrieve the first
> result. If I do, "@geodist" => 0.00..10000.0, it doesn't even give me the
> matching result.
>
> Thinking Sphnix version: 2.0.7
>
> Any help will be appreciated. Thanks in-advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.