ruby on rails - Index a boolean field as a string in sphinx -


I have to use sphinx to search a postgrad database.

I'm searching for a field in the table is a boolean

Explain fully with the example:
My site is for those who develop their black And white film
I have a recipe table where people describe how they develop a movie. In that table there is a bullion column called "stand_disitive" (a method of developing the film).
I would like to return those results where the field is correct when the user searches for the word "stand"

I went through it and actually did not find it possible.

I think that I can hack something by parsing some queries inside my controlling system and adding a condition but it's a cleaner way of doing it?

This is what I have done, as a search on boolean areas in the form of thinking- I In the questions, pass stand_developed near the URL parameter with your query_string:

  1. The URL for the generic query will not be searched on stand_developed < The URL for the query with Code> http://yoursite.com/search?q=your_query_string
  2. stand_developed == TRUE would be http: / /yoursite.com/search?q=your_query_string&stand_developed=1
  3. with stand_developed == FALSE URL for Eri would be http: // youiteite .com / search? Q = your_query_string & amp; Stand_developed = 0

Then, in your controller, you will:

  if the parameter [: stand_device] & amp; Amp; Params [: stand_developed] .to_i == 1 # search_result_developed == true = search_results = yourModel.search (params [: q] ,: with => {: stand_developed = & gt; true}) Params [: stand_desktop] & amp; Amp; Perform Parameters with Params [: stand_developed] .to_i == 0 # stand_developed == incorrect @search_results = yourModel.search (params [: q] ,: with => {: stand_developed = & gt; false}) # Other general display query search @search_results = YourModel.search (param [: q]) end  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -