README.md in mongoid_fulltext-0.3.6 vs README.md in mongoid_fulltext-0.4.0
- old
+ new
@@ -205,10 +205,14 @@
* `word_separators`: word separators, default is ` `
* `ngram_width`: ngram width, default is `3`
* `index_full_words`: index full words, which improves exact matches, default is `true`
* `apply_prefix_scoring_to_all_words`: score n-grams at beginning of words higher, default is `true`
* `max_ngrams_to_search`: maximum number of ngrams to query at any given time, default is `6`
+* `max_candidate_set_size`: maximum number of candidate ngrams to examine for a given query.
+ Defaults to 1000. If you're seeing poor results, you can try increasing this value to consider
+ more ngrams per query (changing this parameter does not require a re-index.) The amount of time
+ a search takes is directly proportional to this parameter's value.
Array filters
-------------
A filter may also return an Array. Consider the following example.
@@ -241,17 +245,22 @@
Building the index
------------------
The fulltext index is built and maintained incrementally by hooking into `before_save` and
`before_destroy` callbacks on each model that's being indexed. If you want to build an index
-on existing models, you can call the `update_ngram_index` method on each instance:
+on existing models, you can call the `update_ngram_index` method on the class or each instance:
- Artwork.all.each { |artwork| artwork.update_ngram_index }
+ Artwork.update_ngram_index
+ Artwork.find(id).update_ngram_index
-You can also remove instances in bulk from the index with the `remove_from_ngram_index`
+You can remove all or individual instances from the index with the `remove_from_ngram_index`
method:
- Artwork.all.each { |artwork| artwork.remove_from_ngram_index }
+ Artwork.remove_from_ngram_index
+ Artwork.find(id).remove_from_ngram_index
+
+The methods on the model level perform bulk removal operations and are therefore faster that
+updating or removing records individually.
Running the specs
-----------------
To run the specs, execute `rake spec`. You need a local MongoDB instance to run the specs.