ruby on rails - Tire returning empty array -


i using elasticsearch make search fast, unfortunately don't know reason why returning empty array of result. looking forward guys.

class post < activerecord::base     include tire::model::search     include tire::model::callbacks      has_many :attachments, as: :attachable     accepts_nested_attributes_for :attachments, allow_destroy: true      mapping         indexes :work_type         indexes :title         indexes :location         indexes :industry_type         indexes :key_words         indexes :type            end      after_save { update_index }      def self.search(params)         tire.search(load: true)             query                 boolean                     must   { string                              params[:query] }         if params[:query].present?                     must   { match :type,          params[:type] }          if params[:type].present? && params[:type] != "all"                     must   { match :title,         params[:title] }         if params[:title].present?                     must   { match :industry_type, params[:industry_type] } if params[:industry_type].present?                     must   { match :key_words,     params[:key_words] }     if params[:key_words].present?                 end             end              sort { :title, 'desc' }         end     end   params = {"utf8"=>"✓",  "type"=>"job",  "query"=>"",  "location"=>"",  "post"=>{"work_type"=>""},  "action"=>"index",  "controller"=>"posts"} 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -