Sha256: 4e431feba806cd9a67825c2df1f15d377a2c92e833036f4ae02103631fcb5ea9

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 Bytes

Contents

module Picky

  #
  #
  class Category

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

15 entries across 15 versions & 1 rubygems

Version Path
picky-4.1.0 lib/picky/category_indexed.rb
picky-4.0.9 lib/picky/category_indexed.rb
picky-4.0.8 lib/picky/category_indexed.rb
picky-4.0.7 lib/picky/category_indexed.rb
picky-4.0.6 lib/picky/category_indexed.rb
picky-4.0.5 lib/picky/category_indexed.rb
picky-4.0.4 lib/picky/category_indexed.rb
picky-4.0.3 lib/picky/category_indexed.rb
picky-4.0.1 lib/picky/category_indexed.rb
picky-4.0.0 lib/picky/category_indexed.rb
picky-4.0.0pre6 lib/picky/category_indexed.rb
picky-4.0.0pre5 lib/picky/category_indexed.rb
picky-4.0.0pre3 lib/picky/category_indexed.rb
picky-4.0.0pre2 lib/picky/category_indexed.rb
picky-4.0.0pre1 lib/picky/category_indexed.rb