Displaying 1 result from an estimated 1 matches for "to_document".
2005 Nov 26
3
Several questions about Ferret.
...s for ferret?? I am tried to use
following code but it seems does not work correctly. Document indexed twice
after object update. Could you help me to write right Rails hook methods??
def after_save
index = FerretConfig::INDEX
index.remove(self.id.to_s)
index.update(self.id.to_s, self.to_document)
index.optimize
end
def before_destroy
index = FerretConfig::INDEX
index.remove(self.id.to_s)
index.optimize
end
def to_document
doc = Document.new
doc << Field.new(''id'', self.id.to_s, Field::Store::YES,
Field::Index::UNTOKENIZED)...