Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #131 from mikepack/more-like-this-example

More like this example
  • Loading branch information...
commit 55aa0ebd1bea4d2d9a9f78fb23080870c9f62397 2 parents 23ae1f3 + 4415e9e
alindeman alindeman authored
Showing with 26 additions and 1 deletion.
  1. +26 −1 README.md
27 README.md
View
@@ -465,7 +465,32 @@ TODO
### More Like This
-TODO
+Sunspot can extract related items using more_like_this. When searching
+for similar items, you can pass a block with the following options:
+
+* fields :field_1[, :field_2, ...]
+* minimum_term_frequency ##
+* minimum_document_frequency ##
+* minimum_word_length ##
+* maximum_word_length ##
+* maximum_query_terms ##
+* boost_by_relevance true/false
+
+```ruby
+class Post < ActiveRecord::Base
+ searchable do
+ # The :more_like_this option must be set to true
+ text :body, :more_like_this => true
+ end
+end
+
+post = Post.first
+
+results = Sunspot.more_like_this(post) do
+ fields :body
+ minimum_term_frequency 5
+end
+```
## Indexing In Depth
Please sign in to comment.
Something went wrong with that request. Please try again.