2
votes

How can you specify the order of facets in Tire?

Its possible in Elasticsearch as seen here: http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html

In tire its defaults to 'count' however I cant figure out how to change it to the 'term' order.

Here is my search method:

def self.search(params)
tire.search do
  query do
    boolean do
      must { string params[:query], default_operator: "AND" } if params[:query].present?
    end
  end
  facet "article_ratings" do
    terms :article_rating
  end
  # raise to_curl
end

end

1

1 Answers

2
votes

Figured it out...

facet "article_ratings" do
    terms :article_rating, :order => 'term'
  end