Sha256: 17c1e93fd9c46451736176a14cf3cc280eabaf3d5f02d81a223f460a0953fad2

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

module Cadet
  module CadetIndex
    class Index
      def initialize(lucene_index, name, type)
        @name = name
        @type = type
        @index = {}
        @lucene_index = lucene_index
      end
      def add(node, prop, value)
        @index[prop] ||= {}
        @index[prop][value] = node
      end
      def get(property, value)
        @index[property] ||= {}
        [@index[property][value]]
      end
      def flush
        index = @lucene_index.nodeIndex @name, @type
        @index.each do |property, mappings|
          mappings.each do |value, node|
            index.add(node, {property => value})
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cadet-0.0.6-java lib/cadet/cadet_index/index.rb
cadet-0.0.5-java lib/cadet/cadet_index/index.rb
cadet-0.0.4-java lib/cadet/cadet_index/index.rb
cadet-0.0.3-java lib/cadet/cadet_index/index.rb
cadet-0.0.2-java lib/cadet/cadet_index/index.rb