diff --git a/pages b/pages index cf6f86a93..a7279f31e 160000 --- a/pages +++ b/pages @@ -1 +1 @@ -Subproject commit cf6f86a936c54c057f4ba79196210d5198260b7c +Subproject commit a7279f31eea16751467858ec0235ed20909ec7c2 diff --git a/sunspot/lib/sunspot.rb b/sunspot/lib/sunspot.rb index 3041e9d0e..8492ae8be 100644 --- a/sunspot/lib/sunspot.rb +++ b/sunspot/lib/sunspot.rb @@ -327,6 +327,34 @@ def new_more_like_this(object, *types, &block) session.new_more_like_this(object, *types, &block) end + # + # Initiate a MoreLikeThis search. MoreLikeThis is a special type of search + # that finds similar documents using fulltext comparison. The fields to be + # compared are `text` fields set up with the `:more_like_this` option set to + # `true`. By default, more like this returns objects of the same type as the + # object used for comparison, but a list of types can optionally be passed + # to this method to return similar documents of other types. This will only + # work for types that have common fields. + # + # The DSL for MoreLikeThis search exposes several methods for setting + # options specific to this type of search. See the + # Sunspot::DSL::MoreLikeThis class and the MoreLikeThis documentation on + # the Solr wiki: http://wiki.apache.org/solr/MoreLikeThis + # + # MoreLikeThis searches have all of the same scoping, ordering, and faceting + # functionality as standard searches; the only thing you can't do in a MLT + # search is fulltext matching (since the MLT itself is a fulltext query). + # + # #### Example + # + # post = Post.first + # Sunspot.more_like_this(post, Post, Page) do + # fields :title, :body + # with(:updated_at).greater_than(1.month.ago) + # facet(:category_ids) + # end + # + # def more_like_this(object, *types, &block) session.more_like_this(object, *types, &block) end