Sha256: ba41b57f64a8aa7696035a9385b5cb75f610df20006e1e1c06ce9c667efed587
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
#!/usr/bin/env jruby require 'java' Dir[File.join(File.dirname(__FILE__), 'jars', 'lucene', '*.jar')].each { |jar| require jar } Dir[File.join(File.dirname(__FILE__), 'jars', 'solr', '*.jar')].each { |jar| require jar } require File.join(File.dirname(__FILE__), 'solr_ext') require File.join(File.dirname(__FILE__), 'lucene') require File.join(File.dirname(__FILE__), 'queries') require File.join(File.dirname(__FILE__), 'remote') require File.join(File.dirname(__FILE__), 'jetty') module Solrium #wrapper for SolrCore class Solr include Queries include Remote include_class 'org.apache.solr.core.SolrCore' include_class 'org.apache.solr.core.SolrConfig' attr_accessor :config, :core def initialize(solr_home='solr-instance') Java::JavaLang::System.setProperty("solr.solr.home", solr_home) @config = SolrConfig.new @core = SolrCore.new('core', nil, @config, nil, nil) at_exit do @core.close rescue nil end end def analyzer core.schema.analyzer end def with_searcher(&block) searcher_ref = core.searcher searcher = searcher_ref.get begin block.call(searcher) ensure searcher_ref.decref end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jberkel-solrium-0.1.0 | lib/solr.rb |