2012-11-28 64 views
0

我在設置布爾查詢中的minimum_number_should_match時遇到了一些麻煩。我想知道我該如何設定。另外,什麼是默認值?如何在輪胎內設置Elastic Search的minimum_number_should_match?

options = {:minimum_number_should_match => 1} 

result = tire.search(load: true, page: params[:page], per_page: 20) do 
    query do 
    boolean do 
     must {string squery, default_operator: "OR"} if squery.present? 
     must {term :aasm_state, aasm_state } 
     must {text :zipcode, zipcode} unless zipcode.nil? 
     should {text :city, city} if city 
     should {term :phone_store, true} 
     should {term :email_store, true} 
    end 
    end 

    sort {by :created_at, 'desc' } if squery.blank? 
end 

回答