0

我有一Profile堂课。在 ES 索引中我有company_type属性。

class Profile
  ...
  include Tire::Model::Search
  include Tire::Model::Callbacks

  def to_indexed_json
    { name: self.name,
      company_type: self.company.company_type
    }.to_json
  end
end

Tire.search('profiles') do
  query do
    custom_filters_score do
      query { all }

      filter do
        filter :range, last_contact_at: { gte: 7.days.ago }
        boost 1
      end

      score_mode :total
    end
  end
end.results

我想通过10查询来提升 if company_type == 'intern'

4

1 回答 1

1

你尝试添加

filter do
  filter :term, company_type: "intern"
  boost 10.0
end

到你的custom_filters_score过滤器?

于 2013-06-27T12:57:46.220 回答