2013-07-24 42 views
1

我试图检查与轮胎,如果一个字段为空。 这是我对我的模型的查询。我如何检查一个字段是否为空或轮胎上的轮胎宝石为空

def self.search(params) 
    tire.search(load: true, match_all: {}, page: params[:page], per_page: 12) do 
    query do 
     boolean do 
     must { string params[:query], default_operator: "AND" } 
     must { term :online, true } 
     must_not { string 'name:Undefined' } 
     must_not { term 'price:null' } 
     end 
    end 
    end 
end 

must_not { term 'price:null' } is the code wich leads me to an error. 

我该怎么办? 感谢

回答

0

使用

must_not { |m| m.term "price", nil } 
+0

对不起,不能正常工作。 –