Sha256: dfaba699f9dcfa85eca2944bf69e32c87096bd8738ca8ea4e799bb6b1de6e0bd

Contents?: true

Size: 831 Bytes

Versions: 38

Compression:

Stored size: 831 Bytes

Contents

module Picky

  #
  #
  class Category

    # Loads the index from cache.
    #
    def load
      Picky.logger.load self
      clear_realtime # THINK Should we really explicitly clear the realtime? Or should it just be loaded?
      exact.load
      partial.load
    end

    # Gets the weight for this token's text.
    #
    def weight token
      bundle_for(token).weight token.text
    end

    # Gets the ids for this token's text.
    #
    def ids token
      bundle_for(token).ids token.text
    end

    # Returns the right index bundle for this token.
    #
    def bundle_for token
      token.partial? ? partial : exact
    end

    # Returns a combination for the token,
    # or nil, if there is none.
    #
    def combination_for token
      weight(token) && Query::Combination.new(token, self)
    end

  end

end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
picky-4.5.6 lib/picky/category_indexed.rb
picky-4.5.5 lib/picky/category_indexed.rb
picky-4.5.4 lib/picky/category_indexed.rb
picky-4.5.3 lib/picky/category_indexed.rb
picky-4.5.2 lib/picky/category_indexed.rb
picky-4.5.1 lib/picky/category_indexed.rb
picky-4.5.0 lib/picky/category_indexed.rb
picky-4.4.2 lib/picky/category_indexed.rb
picky-4.4.1 lib/picky/category_indexed.rb
picky-4.4.0 lib/picky/category_indexed.rb
picky-4.3.2 lib/picky/category_indexed.rb
picky-4.3.1 lib/picky/category_indexed.rb
picky-4.3.0 lib/picky/category_indexed.rb
picky-4.2.4 lib/picky/category_indexed.rb
picky-4.2.3 lib/picky/category_indexed.rb
picky-4.2.2 lib/picky/category_indexed.rb
picky-4.2.1 lib/picky/category_indexed.rb
picky-4.2.0 lib/picky/category_indexed.rb