Sha256: d69b79fc38ffb987a66ef2c1c5645f7d1c293f5ade79579fd8b495b71102d10d

Contents?: true

Size: 865 Bytes

Versions: 7

Compression:

Stored size: 865 Bytes

Contents

module Picky

  #
  #
  class Category

    # Loads the index from cache.
    #
    def load
      timed_exclaim %Q{"#{identifier}": Loading index from cache.}
      clear_realtime_mapping # TODO What to do?
      exact.load
      partial.load
    end
    # TODO Remove in 4.0.
    #
    alias reload load

    # 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

7 entries across 7 versions & 1 rubygems

Version Path
picky-3.6.7 lib/picky/category_indexed.rb
picky-3.6.6 lib/picky/category_indexed.rb
picky-3.6.4 lib/picky/category_indexed.rb
picky-3.6.3 lib/picky/category_indexed.rb
picky-3.6.2 lib/picky/category_indexed.rb
picky-3.6.1 lib/picky/category_indexed.rb
picky-3.6.0 lib/picky/category_indexed.rb