README.md in mongoid_fulltext-0.4.5 vs README.md in mongoid_fulltext-0.5.0
- old
+ new
@@ -48,10 +48,20 @@
To return a pair of `[ result, score ]` instead of an array of results, pass the `:return_scores` parameter to `fulltext_search`:
Artist.fulltext_search("vince vangogh", { :return_scores => true })
+The larger a score is, the better mongoid_fulltext thinks the match is. The scores have the following rough
+interpretation that you can use to make decisions about whether the match is good enough:
+
+* If a prefix of your query matches something indexed, or if your query matches a prefix of something
+ indexed (for example, searching for "foo" finds "myfoo" or searching for "myfoo" finds "foo"), you
+ can expect a score of at least 1 for the match.
+* If an entire word in your query matches an entire word that's indexed and you have the `index_full_words`
+ option turned on (it's turned on by default), you can expect a score of at least 2 for the match.
+* If neither of the above criteria are met, you can expect a score less than one.
+
If you don't specify a field to index, the default is the result of `to_s` called on the object.
The following definition will index the first and last name of an artist:
class Artist
include Mongoid::Document
@@ -217,13 +227,13 @@
URL, for instance we might have "%C3%A9" which is how an "e-accute" ("é") gets passed
through a web-browser. These are then changed to their UTF-8 equivalents (via the `CGI` gem)
and then finally stripped, as before.
* `update_if`: controls whether or not the index will be updated. This can be set to a symbol,
string, or proc. If the result of evaluating the value is true, the index will be updated.
-** When set to a symbol, the symbol is sent to the document.
-** When set to a string, the string is evaluated within the document's instance.
-** When set to a proc, the proc is called, and the document is given to the proc as the first arg.
-** When set to any other type of object, the document's index will not be updated.
+ * When set to a symbol, the symbol is sent to the document.
+ * When set to a string, the string is evaluated within the document's instance.
+ * When set to a proc, the proc is called, and the document is given to the proc as the first arg.
+ * When set to any other type of object, the document's index will not be updated.
Array filters
-------------
A filter may also return an Array. Consider the following example.