Sha256: 92c94703a4c60ec5a041c853fbf3cc3ee48ce46006d6615fc7d20ecc698cadfc

Contents?: true

Size: 961 Bytes

Versions: 16

Compression:

Stored size: 961 Bytes

Contents

module Picky

  # Indexes indexing.
  #
  class Indexes

    instance_delegate :index,
                      :clear,
                      :index_for_tests,
                      :tokenizer

    each_delegate :clear,
                  :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 ;)
    #
    # TODO Rename to #index_without_forking, or just #index.
    #
    def index_for_tests
      indexes.each(&:index)
    end

    #
    #
    def tokenizer
      Tokenizer.index_default
    end

  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
picky-3.6.16 lib/picky/indexes_indexing.rb
picky-3.6.15 lib/picky/indexes_indexing.rb
picky-3.6.14 lib/picky/indexes_indexing.rb
picky-3.6.13 lib/picky/indexes_indexing.rb
picky-3.6.12 lib/picky/indexes_indexing.rb
picky-3.6.11 lib/picky/indexes_indexing.rb
picky-3.6.10 lib/picky/indexes_indexing.rb
picky-3.6.9 lib/picky/indexes_indexing.rb
picky-3.6.8 lib/picky/indexes_indexing.rb
picky-3.6.7 lib/picky/indexes_indexing.rb
picky-3.6.6 lib/picky/indexes_indexing.rb
picky-3.6.4 lib/picky/indexes_indexing.rb
picky-3.6.3 lib/picky/indexes_indexing.rb
picky-3.6.2 lib/picky/indexes_indexing.rb
picky-3.6.1 lib/picky/indexes_indexing.rb
picky-3.6.0 lib/picky/indexes_indexing.rb