Changeset 321

Show
Ignore:
Timestamp:
05/05/08 03:21:47 (7 months ago)
Author:
eric.dumin..@gmail.com
Message:

Indexer#should_index_this_document? method added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/picolena/templates/app/models/indexer.rb

    r319 r321  
    3939      indexing_list_chunks.each_with_thread{|chunk| 
    4040        chunk.each{|complete_path| 
    41           last_itime=index_time_dbm_file[complete_path] 
    42           if @from_scratch || !last_itime || File.mtime(complete_path)> Time._load(last_itime) then 
     41          if should_index_this_document?(complete_path) then 
    4342            add_or_update_file(complete_path) 
    4443          else 
     
    109108      Time._load(index_time_dbm_file['last']) rescue "none" 
    110109    end 
     110     
     111    # For a given document, it retrieves the time it was last indexed, compare it to 
     112    # its modification time and returns false unless the file has been 
     113    # modified after the last indexing process. 
     114    def should_index_this_document?(complete_path) 
     115      last_itime=index_time_dbm_file[complete_path] 
     116      @from_scratch || !last_itime || File.mtime(complete_path)> Time._load(last_itime)  
     117    end 
    111118 
    112119    private