Sha256: e1d9d8bc8dac64f63f51b17d262e01a16f349c130889e2f9284984b07c3bdc2e
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
module Index # A Bundle is a number of indexes # per [index, category] combination. # # At most, there are three indexes: # * *core* index (always used) # * *weights* index (always used) # * *similarity* index (used with similarity) # # In Picky, indexing is separated from the index # handling itself through a parallel structure. # # Both use methods provided by this base class, but # have very different goals: # # * *Indexing*::*Bundle* is just concerned with creating index files # and providing helper functions to e.g. check the indexes. # # * *Index*::*Bundle* is concerned with loading these index files into # memory and looking up search data as fast as possible. # class Bundle attr_reader :identifier, :files attr_accessor :index, :weights, :similarity, :similarity_strategy delegate :[], :[]=, :clear, :to => :index def initialize name, configuration, similarity_strategy @identifier = "#{configuration.identifier} (#{name})" @files = Files.new name, configuration @index = {} @weights = {} @similarity = {} @similarity_strategy = similarity_strategy end # Get a list of similar texts. # def similar text code = similarity_strategy.encoded text code && @similarity[code] || [] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
picky-0.12.1 | lib/picky/index/bundle.rb |
picky-0.12.0 | lib/picky/index/bundle.rb |