This is what I've done as far as searching on boolean fields using ThinkingSphinx. Pass stand_developed
as a URL parameter along with your query_string in the following ways:
- URL for a general query without search on
stand_developed
will be http://yoursite.com/search?q=your_query_string
- URL for query with
stand_developed == TRUE
will be http://yoursite.com/search?q=your_query_string&stand_developed=1
- URL for query with
stand_developed == FALSE
will be http://yoursite.com/search?q=your_query_string&stand_developed=0
Then, in your controller, you would do this:
if params[:stand_developed] && params[:stand_developed].to_i == 1
# perform query search with stand_developed == true
@search_results = YourModel.search(params[:q], :with => {:stand_developed => true})
elsif params[:stand_developed] && params[:stand_developed].to_i == 0
# perform query search with stand_developed == false
@search_results = YourModel.search(params[:q], :with => {:stand_developed => false})
else
# perform general query search
@search_results = YourModel.search(params[:q])
end