Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add MLT documentation

  • Loading branch information...
commit 0330b94c1f9becd699d71aba0b6decce3ec7696e 1 parent 08e105b
authored September 16, 2010
2  pages
... ...
@@ -1 +1 @@
1  
-Subproject commit cf6f86a936c54c057f4ba79196210d5198260b7c
  1
+Subproject commit a7279f31eea16751467858ec0235ed20909ec7c2
28  sunspot/lib/sunspot.rb
@@ -327,6 +327,34 @@ def new_more_like_this(object, *types, &block)
327 327
       session.new_more_like_this(object, *types, &block)
328 328
     end
329 329
 
  330
+    # 
  331
+    # Initiate a MoreLikeThis search. MoreLikeThis is a special type of search
  332
+    # that finds similar documents using fulltext comparison. The fields to be
  333
+    # compared are `text` fields set up with the `:more_like_this` option set to
  334
+    # `true`. By default, more like this returns objects of the same type as the
  335
+    # object used for comparison, but a list of types can optionally be passed
  336
+    # to this method to return similar documents of other types. This will only
  337
+    # work for types that have common fields.
  338
+    #
  339
+    # The DSL for MoreLikeThis search exposes several methods for setting
  340
+    # options specific to this type of search. See the
  341
+    # Sunspot::DSL::MoreLikeThis class and the MoreLikeThis documentation on
  342
+    # the Solr wiki: http://wiki.apache.org/solr/MoreLikeThis
  343
+    #
  344
+    # MoreLikeThis searches have all of the same scoping, ordering, and faceting
  345
+    # functionality as standard searches; the only thing you can't do in a MLT
  346
+    # search is fulltext matching (since the MLT itself is a fulltext query).
  347
+    #
  348
+    # #### Example
  349
+    #
  350
+    # post = Post.first
  351
+    # Sunspot.more_like_this(post, Post, Page) do
  352
+    #   fields :title, :body
  353
+    #   with(:updated_at).greater_than(1.month.ago)
  354
+    #   facet(:category_ids)
  355
+    # end
  356
+    #
  357
+    #
330 358
     def more_like_this(object, *types, &block)
331 359
       session.more_like_this(object, *types, &block)
332 360
     end

0 notes on commit 0330b94

Please sign in to comment.
Something went wrong with that request. Please try again.