karmi / tire-contrib

Additions and extensions for the Tire gem
MIT License
65 stars 31 forks source link

Add more like this API call #25

Open tmaier opened 11 years ago

tmaier commented 11 years ago

This is more a proof of concept if and how to implement _mlt http://www.elasticsearch.org/guide/reference/api/more-like-this/

This is how to call it currently

tire.more_like_this(page: params[:page], per_page: params[:per_page], mlt_fields: %w(title subtitle abstract series journal), min_term_freq: 1, min_doc_freq: 2) do
  query do
    all
  end

  Rails.logger.debug to_curl
end

I would love to hear feedback on this.

karmi commented 11 years ago

Hi, there's already support for more_like_this, https://github.com/karmi/tire-contrib/blob/master/lib/tire/queries/more_like_this.rb, though not for the index/type/id/_mlt endpoint. Can you look into it please? Also, without tests, it's hard to validate the feature and, usually, tests are the best documentation.