lib/mongoid_fulltext.rb in mongoid_fulltext-0.5.6 vs lib/mongoid_fulltext.rb in mongoid_fulltext-0.5.7
- old
+ new
@@ -30,10 +30,11 @@
:apply_prefix_scoring_to_all_words => true,
:index_full_words => true,
:index_short_prefixes => false,
:max_candidate_set_size => 1000,
:remove_accents => true,
+ :reindex_immediately => true,
:stop_words => Hash[['i', 'a', 's', 't', 'me', 'my', 'we', 'he', 'it', 'am', 'is', 'be', 'do', 'an', 'if',
'or', 'as', 'of', 'at', 'by', 'to', 'up', 'in', 'on', 'no', 'so', 'our', 'you', 'him',
'his', 'she', 'her', 'its', 'who', 'are', 'was', 'has', 'had', 'did', 'the', 'and',
'but', 'for', 'out', 'off', 'why', 'how', 'all', 'any', 'few', 'nor', 'not', 'own',
'too', 'can', 'don', 'now', 'ours', 'your', 'hers', 'they', 'them', 'what', 'whom',
@@ -52,10 +53,10 @@
config[:ngram_fields] = args
config[:alphabet] = Hash[config[:alphabet].split('').map{ |ch| [ch,ch] }]
config[:word_separators] = Hash[config[:word_separators].split('').map{ |ch| [ch,ch] }]
self.mongoid_fulltext_config[index_name] = config
- before_save :update_ngram_index
+ before_save(:update_ngram_index) if config[:reindex_immediately]
before_destroy :remove_from_ngram_index
end
def create_fulltext_indexes
return unless self.mongoid_fulltext_config