Sha256: f14b6c80a9bb20a1effcf3e97601cb04a9cf433564ddbed7aaa5ac55273b011c

Contents?: true

Size: 857 Bytes

Versions: 9

Compression:

Stored size: 857 Bytes

Contents

module Picky

  #
  #
  class Category

    # Loads the index from cache.
    #
    def load
      timed_exclaim %Q{"#{identifier}": Loading index from cache.}
      clear_realtime # 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

9 entries across 9 versions & 1 rubygems

Version Path
picky-3.6.16 lib/picky/category_indexed.rb
picky-3.6.15 lib/picky/category_indexed.rb
picky-3.6.14 lib/picky/category_indexed.rb
picky-3.6.13 lib/picky/category_indexed.rb
picky-3.6.12 lib/picky/category_indexed.rb
picky-3.6.11 lib/picky/category_indexed.rb
picky-3.6.10 lib/picky/category_indexed.rb
picky-3.6.9 lib/picky/category_indexed.rb
picky-3.6.8 lib/picky/category_indexed.rb