Changeset 280
- Timestamp:
- 04/26/08 08:29:38 (7 months ago)
- Files:
-
- trunk/History.txt (modified) (1 diff)
- trunk/lib/picolena/templates/app/models/indexer.rb (modified) (4 diffs)
- trunk/lib/picolena/templates/config/environment.rb (modified) (1 diff)
- trunk/lib/picolena/templates/lib/tasks/install_dependencies.rake (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/History.txt
r277 r280 3 3 * 1 minor enhancement: 4 4 * added cache highlighting à la Google 5 * rake index:update implemented as described in Ferret book by David Balmain 5 6 6 7 == 0.1.6 2008-04-25 trunk/lib/picolena/templates/app/models/indexer.rb
r267 r280 11 11 @@do_not_disturb_while_indexing=true 12 12 clear! if remove_first 13 @from_scratch = remove_first 13 14 # Forces Finder.searcher and Finder.index to be reloaded, by removing them from the cache. 14 15 Finder.reload! … … 36 37 37 38 indexing_list_chunks.each_with_thread{|chunk| 38 chunk.each{|filename| 39 add_file(filename) 39 chunk.each{|complete_path| 40 last_itime=index_time_dbm_file[complete_path] 41 if @from_scratch || !last_itime || File.mtime(complete_path)> Time._load(last_itime) then 42 add_or_update_file(complete_path) 43 else 44 log :debug => "Identical : #{complete_path}" 45 end 46 index_time_dbm_file[complete_path] = Time.now._dump 40 47 } 41 48 } 42 49 end 43 50 44 def add_ file(complete_path)51 def add_or_update_file(complete_path) 45 52 default_fields = Document.default_fields_for(complete_path) 46 53 begin … … 87 94 88 95 private 96 97 # Copied from Ferret book, By David Balmain 98 def index_time_dbm_file 99 @@dbm_file ||= DBM.open(File.join(Picolena::IndexSavePath, 'added_at')) 100 end 89 101 90 102 def index_exists? … … 131 143 # Ferret::Store::Lock::LockError 132 144 index 145 # Opens dbm file to dump indexing time. 146 index_time_dbm_file 133 147 # NOTE: is it really necessary? 134 148 # ActiveSupport sometime raises trunk/lib/picolena/templates/config/environment.rb
r263 r280 1 %w(rubygems paginator fileutils pathname logger thread ).each{|lib| require lib}1 %w(rubygems paginator fileutils pathname logger thread dbm).each{|lib| require lib} 2 2 3 3 # Uncomment below to force Rails into production mode when trunk/lib/picolena/templates/lib/tasks/install_dependencies.rake
r263 r280 31 31 root_privileges_required! 32 32 #TODO: Should load this list from defined PlainTextExtractor's 33 packages=%w{antiword poppler-utils odt2txt html2text catdoc unrtf mguesser }.join(" ")33 packages=%w{antiword poppler-utils odt2txt html2text catdoc unrtf mguesser libdbm-ruby1.8}.join(" ") 34 34 puts "Installing "<<packages 35 35 system("apt-get install "<<packages)
