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.11.1 lib/picky/category_indexed.rb
picky-4.11.0 lib/picky/category_indexed.rb
picky-4.10.0 lib/picky/category_indexed.rb
picky-4.9.0 lib/picky/category_indexed.rb
picky-4.8.1 lib/picky/category_indexed.rb
picky-4.8.0 lib/picky/category_indexed.rb
picky-4.7.0 lib/picky/category_indexed.rb
picky-4.6.6 lib/picky/category_indexed.rb
picky-4.6.5 lib/picky/category_indexed.rb
picky-4.6.4 lib/picky/category_indexed.rb
picky-4.6.3 lib/picky/category_indexed.rb
picky-4.6.2 lib/picky/category_indexed.rb
picky-4.6.1 lib/picky/category_indexed.rb
picky-4.6.0 lib/picky/category_indexed.rb
picky-4.5.12 lib/picky/category_indexed.rb
picky-4.5.11 lib/picky/category_indexed.rb
picky-4.5.10 lib/picky/category_indexed.rb
picky-4.5.9 lib/picky/category_indexed.rb
picky-4.5.8 lib/picky/category_indexed.rb
picky-4.5.7 lib/picky/category_indexed.rb