Method: MiddleSquid::Indexer#index

Defined in:
lib/middle_squid/indexer.rb

#index(directories) ⇒ Object

Parameters:

  • directories (Array<String>)


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/middle_squid/indexer.rb', line 55

def index(directories)
  if !@full_index && @cats_in_use.empty?
    oops 'the loaded configuration does not use any blacklist'
    info 'nothing to do in minimal indexing mode'
    return
  end

  start_time = Time.now

  db.transaction

  truncate unless @append
  directories.each {|dir|
    walk_in dir
  }
  cats_summary
  stats
  commit_or_rollback

  end_time = Time.now
  info "finished after #{end_time - start_time} seconds"
ensure
  db.rollback if db.transaction_active?
end