Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more like this API call #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add more like this API call #25

wants to merge 3 commits into from

Conversation

tmaier
Copy link

@tmaier tmaier commented Jun 14, 2013

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 don't like that I had to copy so much from other methods. Would love if I could solve this with even much less code
  • There are no tests

I would love to hear feedback on this.

  • Am I doing it right?
  • What would you do differently?
  • Is this useful in general?

tmaier added 3 commits June 14, 2013 23:24
* Inherits from Tire::Search::Search
* #initialize is a copy of original method
* Add document_id as attribute
* Change path to /_mlt
* Copy of Tire::Model::Search::ClassMethods.search
* Handles mlt_fields
* Searches with Tire::Search::MoreLikeThis::Search
@karmi
Copy link
Owner

karmi commented Jul 21, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants