Sha256: ec9beb57e75466a603e78011aac2043afaf8232f39764d7871be205a2b0697c6

Contents?: true

Size: 1015 Bytes

Versions: 1

Compression:

Stored size: 1015 Bytes

Contents

# Indexes indexing.
#
class Indexes

  instance_delegate :index,
                    :check,
                    :clear,
                    :backup,
                    :restore,
                    :index_for_tests,
                    :tokenizer

  each_delegate :check,
                :clear,
                :backup,
                :restore,
                :to => :indexes

  # Runs the indexers in parallel (prepare + cache).
  #
  def index randomly = true
    # Run in parallel.
    #
    timed_exclaim "Indexing using #{Cores.max_processors} processors, in #{randomly ? 'random' : 'given'} order."

    # Run indexing/caching forked.
    #
    Cores.forked self.indexes, { randomly: randomly }, &:index

    timed_exclaim "Indexing finished."
  end

  # For integration testing – indexes for the tests
  # without forking and shouting ;)
  #
  def index_for_tests
    indexes.each(&:index)
  end

  # TODO Doc. Spec. Split into Query/Index.
  #
  def tokenizer
    Tokenizers::Index.default
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-2.7.0 lib/picky/indexes_indexing.rb