4

I'm developing a Ruby on Rails application using Sunspot Solr as an indexer. The thing is i try to use the parameter of the search with :, using strings and it doesn't seem to work. If i pass an int it works fine. Anyone knows how to do it with strings (if it's possible)?

An example of the search i want to do is:

@search = Sunspot.search(Record) do
     fulltext params[:query]
     with :checked, "Checked"
end

:checked is an attribute of the table Record and it validates if a record is checked so it can't be edited.

PD: I'm doing it this way because MySQL doesn't accept booleans.

Wiggin
  • 329
  • 1
  • 3
  • 17

1 Answers1

4

Figured it out!

It turns out strings are a little more delicate, so you have to use:

with(:checked).equal_to("any_value")

For more information see:

https://github.com/sunspot/sunspot/wiki/Scoping-by-attribute-fields

Wiggin
  • 329
  • 1
  • 3
  • 17