Skip to content
Browse files

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

More like this example
  • Loading branch information...
2 parents 23ae1f3 + 4415e9e commit 55aa0ebd1bea4d2d9a9f78fb23080870c9f62397 @alindeman alindeman committed Nov 30, 2011
Showing with 26 additions and 1 deletion.
  1. +26 −1 README.md
View
27 README.md
@@ -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

0 comments on commit 55aa0eb

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