Sha256: b7fada22bcff2bd7e9b345f557a3c39e91abbae822b4615076a4a0d60aef72b4

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

module Picky

  # 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

    #
    #
    def tokenizer
      Tokenizers::Index.default
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
picky-3.0.1 lib/picky/indexes_indexing.rb
picky-3.0.0 lib/picky/indexes_indexing.rb
picky-3.0.0.pre5 lib/picky/indexes_indexing.rb
picky-3.0.0.pre4 lib/picky/indexes_indexing.rb
picky-3.0.0.pre3 lib/picky/indexes_indexing.rb
picky-3.0.0.pre2 lib/picky/indexes_indexing.rb
picky-3.0.0.pre1 lib/picky/indexes_indexing.rb