Hi Pat, Thank you so much for answering my question and providing that code to get me started.
So I have this code in my BusinessLocation model now, but I get this error when I try to index: ERROR: index 'business_location_core': sql_query_range: : macro '$start' not found in match fetch query. Here is my define_index block: http://pastie.org/1205271 On Oct 6, 8:35 pm, Pat Allan <[email protected]> wrote: > Hi Felix > > Sphinx can only deal with single lat/lng pairs for each record - so you're > going to have to have the index on the address model. However, you can group > search results by attributes - so if you have the company_id as an attribute, > you can limit results to one address per company. > > And you can access category and sub_category associations via the company > association in your index definition: > > define_index do > indexes company.name, :as => :company > indexes company.category.name, :as => :category > indexes company.sub_category.name, :as => :subcategory > > has company_id, latitude, longitude > end > > Address.search "foo", :geo => [...@lat, @lng], :group_by => 'company_id' > > So, in short - yes it's possible :) > > Cheers > > -- > Pat > > On 07/10/2010, at 10:13 AM, FelixG wrote: > > > > > Also, I forgot to mention, I have 2 more models called category and > > sub_category. They belong to Company but not to Address. > > > If I index the Address model with the Company attributes, I won't be > > able to access the category and sub_category. > > > Is there a way to index the company model so that it accepts multiple > > addresses for each company? > > > On Oct 6, 6:56 pm, FelixG <[email protected]> wrote: > >> I'm thinking of integrating thinking_sphinx into my app but I am > >> curious if this is possible. > >> Currently I have a Company model and an Address model. > >> Each company can have many addresses in the address model. > > >> Is it possible to index each address for a company with thinking > >> sphinx and then do geo-searching on that? > > >> Any help is appreciated. Thank you. > > > -- > > 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.
