I have been searching for examples but can't seem to find one that shows 
how to implement thinking sphinx as an advanced search form. I have a 
social networking website, and the basic, standard search form works 
excellent with geo search implemented. 
 
I need to offer visitors an advanced search form also so they can have more 
options. For example advanced search fields are gender, ethnicity, child 
preference, and religion. When user selects options it should return users 
with the exact matches only that were chosen. If user selected Male, Asian, 
No Kids, Muslim then it should only returning users that has all of those 
attributes.
Can someone give me one example of this, that way I can modify it and apply 
it to the rest? I'm sure helping me will help others who wants to use this 
gem as a advanced search form.
 
 
Controller:
 

>  def index
>     @search = Search.new
>     
>     if location = Location.find_by_zip_code(params[:search])
>         latitude  = location.latitude * Math::PI / 180 
>         longitude = location.longitude * Math::PI / 180 
>
>         locations = Location.search( 
>           :geo   => [latitude, longitude], 
>           :with  => {:geodist => 0.0..100_000.0}, 
>           :order => 'geodist ASC',
>           :per_page => 5_000
>         ) 
>         @users = User.where(zip_code: locations.map(&:zip_code))
>           else
>             @users = User.search(params[:search].gsub(/\s+/, ' | '),
>             :geo => [current_user.latitude * Math::PI / 180.0, 
> current_user.longitude * Math::PI / 180.0],
>             :with  => {:geodist => 0.0..100_000.0},
>             :order => 'geodist ASC', :without => {:user_id => 
> current_user.id})
>         end      
>       end
>    


-- 
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/d/optout.

Reply via email to