hello pat, hmm...... thats going to bloat my db, imagine 50000 + zip codes for US alone!. User will want to search 5 miles radius, 10 miles radius etc. I think more better solution will be to have longitude and latitude column in the table and make use of the sphinx's inbuilt geo-search mechanism, but i was trying to find if there is an easy path. I guess I don't have many options.
Thank you for your input. Thinking sphinx is a great help to my project. regards On Jul 1, 8:08 pm, Pat Allan <[email protected]> wrote: > Hi there > > The only solution I can think of is to shift the nearby zip codes into a > separate field: > > Items.search 'italian', :conditions => {:zip_code => '14896', > :nearby_zip_codes => '(14897|14898|14899)'} > > And then increase the field weight for zip_code (any fields not mentioned get > a weight of 1): > > :field_weights => {'zip_code' => 10} > > -- > Pat > > On 02/07/2010, at 11:41 AM, madhu wrote: > > > dear Ts experts, > > > I want to search the scenario mentioned below using thinking sphinx. I > > have listed how i am doing it currently, is there a better way? > > > search requriement : search for italian restaurants near zip code > > 14896 > > desired result : display results from zip code 14896 first followed by > > results from surrounding areas > > > My current implementation(it is an extended query, there are more > > fields to be searched,i have removed them to make the query simple) > > > result_one = Items.search "@business:(italian restaurant) @zip_code: > > (14896)",:match_mode => :extended > > result_two = Items.search "@business:(italian restaurant) @zip_code: > > (14897|14898|14899)",:match_mode => :extended > > > result_three = result_one + result_two(and i have taken care > > result_one comes first in the list) > > > There is no guaranty that the items in 14896 will come first If i do > > this: > > result_four = Items.search "@business:(italian restaurant) @zip_code: > > (14896|14897|14898|14899)",:match_mode => :extended > > > Is there a way i can combine this in a single search ? > > > -- > > 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.
