Skip to content

Add more like this API call - #25

Open
tmaier wants to merge 3 commits into
karmi:masterfrom
tmaier:master
Open

Add more like this API call#25
tmaier wants to merge 3 commits into
karmi:masterfrom
tmaier:master

Conversation

@tmaier

@tmaier tmaier commented Jun 14, 2013

Copy link
Copy Markdown

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

karmi commented Jul 21, 2013

Copy link
Copy Markdown
Owner

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