Displaying 3 results from an estimated 3 matches for "optimize_index".
2005 Dec 08
2
Confusing lock problem in rails
...to_flush => true,
:close_dir => true)
# syncronization with ferret index
def after_save
@@index << {:id => id, :email => email, :contents => contents,
:date => found_on}
end
def after_destroy
@@index.delete(id)
end
def self.optimize_index
@@index.optimize
end
def self.search(query, options)
docs = []
count = @@index.search_each(query, options) do |id, score|
doc = {}
doc[:id] = id
doc[:email] = @@index[id][''email'']
doc[:contents] = @@index[id][''contents'']...
2006 Jan 05
2
ActiveRecord callbacks not happening
...ve a model class like so:
class Candidate < ActiveRecord::Base
validates_presence_of :name
@@index = FerretConfig::INDEX
def self.after_destroy
puts "Ferret: after_destroy called"
@@index.query_delete("+id:#{self.id} +ferret_class:#{self.class.name}")
optimize_index
end
end
But when I delete a record, the after_destroy is never called. Nothing
shown on logs from the puts statement. Am I missing something?
Thanks,
Vamsee.
2007 Oct 07
0
ferret performance before optimization
My problem is that I am adding on the order of hundreds of records, so
not that many. The index is REALLY slow after I start adding records
until I call optimize_index (I added a method for that - it''s a ferret
function). Then it drops from >2 seconds to ~100ms per query.
I figure the bulk_index functionality will help close the window of
slowness, but not ideal and I don''t know when that will be added to a
stable tag.
Any idea why this wo...