I'm using algolia to search in a rails app using the algoliasearch-rails gem.
In my product model, I have this:
algoliasearch index_name: "Product" do
attributes :id, :name, :description, :active?
...
end
I'm trying to filter results by a filter called "active?". I'm getting an error back from Algolia when I try to run the search with the parameter included.
{"hits"=>[], "hitsPerPage"=>0, "page"=>0, "facets"=>{}, "error"=>#<Algolia::AlgoliaProtocolError: 400: Cannot POST to https://algolia.net/1/indexes/Product_development/query: {"message":"Unknown parameter: active%3F","status":400}
I can't figure out how to properly reference the parameter. It is working to retrieve the "active?" attribute correctly when I don't filter by active?. I could change the parameter name, but would rather not.
How do I reference an Algolia search attribute that has a question mark in the name for filtering?
:active?
attribute should be just:active
because it is how it is named in the database.:active?
is just and alias for boolean field provided by AR – Slava.K