karmi / tire-contrib

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

Add ability to pass document id to More Like This #24

Open ghost opened 11 years ago

ghost commented 11 years ago

Per: http://www.elasticsearch.org/guide/reference/api/more-like-this/

karmi commented 11 years ago

@mereghost, can you have a look at it? https://github.com/karmi/tire-contrib/blob/master/lib/tire/queries/more_like_this.rb

tmlee commented 11 years ago

Correct me if i'm wrong https://github.com/karmi/tire-contrib/blob/master/lib/tire/queries/more_like_this.rb is doing http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query/

It looks like http://www.elasticsearch.org/guide/reference/api/more-like-this/ uses a direct API call but underneath, it's calling the mlt-query.

Wonder if there's any way we can accomplish the same behavior using the existing search query, or we'll have to implement a direct API call. I might find some time to draft one out maybe.

karmi commented 11 years ago

@tmlee The "more like this document" API is indeed a bit different. You should achieve the same with more_like_this query, just pass the string and the list of fields.

mereghost commented 11 years ago

Oh, crap I just saw that. =/

I intend to implement that as I need it on a project, but schedule is a bit... tight right now. I'll see if I can dedicate some time for this.

karmi commented 11 years ago

@mereghost No worries .)