Elasticsearch + Tire: how to search blank value in string column

50 views Asked by At

I am using elasticsearch with tire(0.6.2) gem in my rails(3.2.22) project. users table having a string column named 'active_code'. I can't able to search with empty string in active_code column.

I tried following samples but i couldn't get.

tire.search(load: true, page: params[:page], per_page: 15) do
  query do
    boolean do
      must { string params[:query], default_operator: "AND" } if  params[:query].present?
      must { term :active_code, '' }
    end #boolean#
  end #query
end

How to resolve this problem?

Thank you.

0

There are 0 answers