Class: Findex::Indexer
- Inherits:
-
Object
- Object
- Findex::Indexer
- Defined in:
- lib/findex/indexer.rb
Overview
Class used for indexing files
Constant Summary collapse
- DB_FLAGS =
Xapian::DB_CREATE_OR_OPEN
Instance Method Summary collapse
-
#initialize(root_path) ⇒ Indexer
constructor
A new instance of Indexer.
- #start ⇒ Object
Constructor Details
#initialize(root_path) ⇒ Indexer
11 12 13 14 15 |
# File 'lib/findex/indexer.rb', line 11 def initialize(root_path) @root_path = Pathname.new(root_path) @findex_path = @root_path + '.findex' setup end |
Instance Method Details
#start ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/findex/indexer.rb', line 17 def start @db.begin_transaction existing = refresh_existing files.each do |file| next if existing.include?(file) insert(file) end @db.commit_transaction end |