Sha256: b59222a16df89ff94ec15c96d752b74cecf94e94d71ec4f6b2d7b7e5ecf1a664

Contents?: true

Size: 585 Bytes

Versions: 6

Compression:

Stored size: 585 Bytes

Contents

# encoding: UTF-8

class Spontaneous::Site
  module Search
    extend Spontaneous::Concern

    def indexer(revision)
      indexer = S::Search::CompoundIndexer.new(revision, indexes.values)
      begin
        yield(indexer)
      ensure
        indexer.close
      end
    end

    def indexes
      @indexes ||= {}
    end

    def [](name)
      indexes[name.to_sym]
    end

    def []=(name, index)
      indexes[name.to_sym] = index
    end

    def index(name, &definition)
      index = S::Search::Index.new(self, name, &definition)
      self[name] = index
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/site/search.rb
spontaneous-0.2.0.beta9 lib/spontaneous/site/search.rb
spontaneous-0.2.0.beta8 lib/spontaneous/site/search.rb
spontaneous-0.2.0.beta7 lib/spontaneous/site/search.rb
spontaneous-0.2.0.beta6 lib/spontaneous/site/search.rb
spontaneous-0.2.0.beta5 lib/spontaneous/site/search.rb