rsolr-direct 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.rdoc +44 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/rsolr-direct.rb +113 -0
- data/solr/dist/apache-solr-1.4.0.war +0 -0
- data/solr/dist/apache-solr-cell-1.4.0.jar +0 -0
- data/solr/dist/apache-solr-clustering-1.4.0.jar +0 -0
- data/solr/dist/apache-solr-core-1.4.0.jar +0 -0
- data/solr/dist/apache-solr-dataimporthandler-1.4.0.jar +0 -0
- data/solr/dist/apache-solr-dataimporthandler-extras-1.4.0.jar +0 -0
- data/solr/dist/apache-solr-solrj-1.4.0.jar +0 -0
- data/solr/example/solr/README.txt +54 -0
- data/solr/lib/commons-codec-1.3.jar +0 -0
- data/solr/lib/commons-csv-1.0-SNAPSHOT-r609327.jar +0 -0
- data/solr/lib/commons-fileupload-1.2.1.jar +0 -0
- data/solr/lib/commons-httpclient-3.1.jar +0 -0
- data/solr/lib/commons-io-1.4.jar +0 -0
- data/solr/lib/easymock.jar +0 -0
- data/solr/lib/geronimo-stax-api_1.0_spec-1.0.1.jar +0 -0
- data/solr/lib/jcl-over-slf4j-1.5.5.jar +0 -0
- data/solr/lib/junit-4.3.jar +0 -0
- data/solr/lib/lucene-analyzers-2.9.1.jar +0 -0
- data/solr/lib/lucene-core-2.9.1.jar +0 -0
- data/solr/lib/lucene-highlighter-2.9.1.jar +0 -0
- data/solr/lib/lucene-memory-2.9.1.jar +0 -0
- data/solr/lib/lucene-misc-2.9.1.jar +0 -0
- data/solr/lib/lucene-queries-2.9.1.jar +0 -0
- data/solr/lib/lucene-snowball-2.9.1.jar +0 -0
- data/solr/lib/lucene-spellchecker-2.9.1.jar +0 -0
- data/solr/lib/servlet-api-2.4.jar +0 -0
- data/solr/lib/slf4j-api-1.5.5.jar +0 -0
- data/solr/lib/slf4j-jdk14-1.5.5.jar +0 -0
- data/solr/lib/solr-commons-csv-pom.xml.template +36 -0
- data/solr/lib/wstx-asl-3.2.7.jar +0 -0
- data/spec/rsolr-direct_spec.rb +53 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +69 -0
- metadata +111 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Matt Mitchell
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
= rsolr-direct
|
2
|
+
rsolr-direct enhances the RSolr core library by adding the ability to connect to Solr directly, using JRuby, sans http. Hotdog!
|
3
|
+
|
4
|
+
= How
|
5
|
+
Check out the specs to see the various connection methods. Overview below...
|
6
|
+
|
7
|
+
==Using :solr_home
|
8
|
+
require 'rsolr-direct'
|
9
|
+
Dir['/path/to/solr/distribution/lib/*.jar', '/path/to/solr/distribution/dist/*.jar'].each do |jar|
|
10
|
+
require jar
|
11
|
+
end
|
12
|
+
connection = RSolr.connect :solr_home => '/absolute/path/to/solr/home'
|
13
|
+
|
14
|
+
==Using a Java::OrgApacheSolrCore::SolrCore instance
|
15
|
+
require 'rsolr-direct'
|
16
|
+
Dir['/path/to/solr/distribution/lib/*.jar', '/path/to/solr/distribution/dist/*.jar'].each do |jar|
|
17
|
+
require jar
|
18
|
+
end
|
19
|
+
core = org.apache.solr.core.SolrCore.new( nil, solr_data_path, solr_config, index_schema, dcore)
|
20
|
+
connection = RSolr.connect core
|
21
|
+
|
22
|
+
==Using a Java::OrgApacheSolrServlet::DirectSolrConnection
|
23
|
+
require 'rsolr-direct'
|
24
|
+
Dir['/path/to/solr/distribution/lib/*.jar', '/path/to/solr/distribution/dist/*.jar'].each do |jar|
|
25
|
+
require jar
|
26
|
+
end
|
27
|
+
dc = org.apache.solr.servlet.DirectSolrConnection.new(solr_home_path, solr_data_path, nil)
|
28
|
+
connection = RSolr.connect dc
|
29
|
+
|
30
|
+
= Why
|
31
|
+
Using a direct connection to Solr can speed up indexing. How much faster? I have no idea yet. Numbers to come?
|
32
|
+
|
33
|
+
== Note on Patches/Pull Requests
|
34
|
+
|
35
|
+
* Fork the project.
|
36
|
+
* Make your feature addition or bug fix.
|
37
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
38
|
+
* Commit, do not mess with rakefile, version, or history
|
39
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
40
|
+
* Send me a pull request. Bonus points for topic branches.
|
41
|
+
|
42
|
+
== Copyright
|
43
|
+
|
44
|
+
Copyright (c) 2010 Matt Mitchell. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "rsolr-direct"
|
8
|
+
gem.summary = %Q{A JRuby, direct connection for RSolr}
|
9
|
+
gem.description = %Q{Provides a non-http connection to your solr/lucene index}
|
10
|
+
gem.email = "goodieboy@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/mwmitchell/rsolr-direct"
|
12
|
+
gem.authors = ["Matt Mitchell"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "rsolr", ">= 0.12.1"
|
15
|
+
|
16
|
+
gem.files = FileList['lib/**/*.rb', 'LICENSE', 'README.rdoc', 'VERSION']
|
17
|
+
gem.test_files = ['spec/*', 'Rakefile', 'solr/dist/*', 'solr/lib/*', 'solr/example/solr/*']
|
18
|
+
|
19
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
+
end
|
21
|
+
# Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'spec/rake/spectask'
|
27
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
33
|
+
spec.libs << 'lib' << 'spec'
|
34
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
35
|
+
spec.rcov = true
|
36
|
+
end
|
37
|
+
|
38
|
+
task :spec => :check_dependencies
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "rsolr-direct #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/lib/rsolr-direct.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
#require 'java'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rsolr'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Connection for JRuby + DirectSolrConnection
|
7
|
+
#
|
8
|
+
module RSolr::Direct
|
9
|
+
|
10
|
+
module Connectable
|
11
|
+
|
12
|
+
def connect *args, &blk
|
13
|
+
first = args.first
|
14
|
+
use_dc = first.is_a?(Hash) and first[:solr_home]
|
15
|
+
use_dc = use_dc || (first.class.to_s == "Java::OrgApacheSolrCore::SolrCore")
|
16
|
+
use_dc = use_dc || (first.class.to_s == "Java::OrgApacheSolrServlet::DirectSolrConnection")
|
17
|
+
if use_dc
|
18
|
+
client = RSolr::Client.new RSolr::Direct::Connection.new(first)
|
19
|
+
if block_given?
|
20
|
+
yield client
|
21
|
+
client.connection.close
|
22
|
+
nil
|
23
|
+
else
|
24
|
+
client
|
25
|
+
end
|
26
|
+
else
|
27
|
+
# use the original connect method
|
28
|
+
super *args, &blk
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
RSolr.extend RSolr::Direct::Connectable
|
35
|
+
|
36
|
+
class Connection
|
37
|
+
|
38
|
+
include RSolr::Connection::Requestable
|
39
|
+
|
40
|
+
attr_accessor :opts
|
41
|
+
|
42
|
+
class MissingRequiredJavaLibs < RuntimeError
|
43
|
+
end
|
44
|
+
|
45
|
+
class InvalidSolrHome < RuntimeError
|
46
|
+
end
|
47
|
+
|
48
|
+
# opts can be an instance of org.apache.solr.servlet.DirectSolrConnection
|
49
|
+
# if opts is NOT an instance of org.apache.solr.servlet.DirectSolrConnection
|
50
|
+
# then...
|
51
|
+
# required: opts[:solr_home] is absolute path to solr home (the directory with "data", "config" etc.)
|
52
|
+
def initialize opts
|
53
|
+
opts ||= {}
|
54
|
+
|
55
|
+
begin
|
56
|
+
org.apache.solr.servlet.DirectSolrConnection
|
57
|
+
rescue NameError
|
58
|
+
raise MissingRequiredJavaLibs
|
59
|
+
end
|
60
|
+
|
61
|
+
if defined?(Java::OrgApacheSolrCore::SolrCore) and opts.is_a?(Java::OrgApacheSolrCore::SolrCore)
|
62
|
+
puts "OKOKOKOK a SolrCore!"
|
63
|
+
@connection = org.apache.solr.servlet.DirectSolrConnection.new(opts)
|
64
|
+
elsif defined?(Java::OrgApacheSolrServlet::DirectSolrConnection) and opts.is_a?(Java::OrgApacheSolrServlet::DirectSolrConnection)
|
65
|
+
@connection = opts
|
66
|
+
else
|
67
|
+
opts[:solr_home] ||= ''
|
68
|
+
raise InvalidSolrHome unless File.exists?(opts[:solr_home])
|
69
|
+
opts[:data_dir] ||= File.join(opts[:solr_home], 'data')
|
70
|
+
@opts = opts
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# sets the @connection instance variable if it has not yet been set
|
75
|
+
def connection
|
76
|
+
@connection ||= (
|
77
|
+
org.apache.solr.servlet.DirectSolrConnection.new(opts[:home_dir], @opts[:data_dir], nil)
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
def close
|
82
|
+
if @connection
|
83
|
+
@connection.close
|
84
|
+
@connection=nil
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# send a request to the connection
|
89
|
+
# request '/select', :q=>'something'
|
90
|
+
# request '/update', :wt=>:xml, '</commit>'
|
91
|
+
def request(path, params={}, data=nil, opts={})
|
92
|
+
data = data.to_xml if data.respond_to?(:to_xml)
|
93
|
+
url = build_url(path, params)
|
94
|
+
begin
|
95
|
+
body = connection.request(url, data)
|
96
|
+
rescue
|
97
|
+
raise RSolr::RequestError.new($!.message)
|
98
|
+
end
|
99
|
+
{
|
100
|
+
:status_code => 200,
|
101
|
+
:url=>url,
|
102
|
+
:body=>body,
|
103
|
+
:path=>path,
|
104
|
+
:params=>params,
|
105
|
+
:data=>data,
|
106
|
+
:headers => {},
|
107
|
+
:message => ''
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
Example "Solr Home" Directory
|
18
|
+
=============================
|
19
|
+
|
20
|
+
This directory is provided as an example of what a "Solr Home" directory
|
21
|
+
should look like.
|
22
|
+
|
23
|
+
It's not strictly necessary that you copy all of the files in this
|
24
|
+
directory when setting up a new instance of Solr, but it is recommended.
|
25
|
+
|
26
|
+
|
27
|
+
Basic Directory Structure
|
28
|
+
-------------------------
|
29
|
+
|
30
|
+
The Solr Home directory typically contains the following subdirectories...
|
31
|
+
|
32
|
+
conf/
|
33
|
+
This directory is mandatory and must contain your solrconfig.xml
|
34
|
+
and schema.xml. Any other optional configuration files would also
|
35
|
+
be kept here.
|
36
|
+
|
37
|
+
data/
|
38
|
+
This directory is the default location where Solr will keep your
|
39
|
+
index, and is used by the replication scripts for dealing with
|
40
|
+
snapshots. You can override this location in the solrconfig.xml
|
41
|
+
and scripts.conf files. Solr will create this directory if it
|
42
|
+
does not already exist.
|
43
|
+
|
44
|
+
lib/
|
45
|
+
This directory is optional. If it exists, Solr will load any Jars
|
46
|
+
found in this directory and use them to resolve any "plugins"
|
47
|
+
specified in your solrconfig.xml or schema.xml (ie: Analyzers,
|
48
|
+
Request Handlers, etc...). Alternatively you can use the <lib>
|
49
|
+
syntax in solrconfig.xml to direct Solr to your plugins. See the
|
50
|
+
example solrconfig.xml file for details.
|
51
|
+
|
52
|
+
bin/
|
53
|
+
This directory is optional. It is the default location used for
|
54
|
+
keeping the replication scripts.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
4
|
+
|
5
|
+
<!--
|
6
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
7
|
+
or more contributor license agreements. See the NOTICE file
|
8
|
+
distributed with this work for additional information
|
9
|
+
regarding copyright ownership. The ASF licenses this file
|
10
|
+
to you under the Apache License, Version 2.0 (the
|
11
|
+
"License"); you may not use this file except in compliance
|
12
|
+
with the License. You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing,
|
17
|
+
software distributed under the License is distributed on an
|
18
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
19
|
+
KIND, either express or implied. See the License for the
|
20
|
+
specific language governing permissions and limitations
|
21
|
+
under the License.
|
22
|
+
-->
|
23
|
+
|
24
|
+
<parent>
|
25
|
+
<groupId>org.apache.solr</groupId>
|
26
|
+
<artifactId>solr-parent</artifactId>
|
27
|
+
<version>@maven_version@</version>
|
28
|
+
</parent>
|
29
|
+
<modelVersion>4.0.0</modelVersion>
|
30
|
+
<groupId>org.apache.solr</groupId>
|
31
|
+
<artifactId>solr-commons-csv</artifactId>
|
32
|
+
<name>Solr Specific Commons CSV</name>
|
33
|
+
<version>@maven_version@</version>
|
34
|
+
<description>Solr Specific Commons CSV</description>
|
35
|
+
<packaging>jar</packaging>
|
36
|
+
</project>
|
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe RSolr::Direct do
|
4
|
+
|
5
|
+
context 'initialization' do
|
6
|
+
|
7
|
+
it 'should modifiy RSolr' do
|
8
|
+
RSolr.should be_a(RSolr::Direct::Connectable)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should not change the default connect behavior' do
|
12
|
+
RSolr.connect.connection.should be_a(RSolr::Connection::NetHttp)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should attempt to use a direct connect if :solr_home is set but raise a MissingRequiredJavaLibs' do
|
16
|
+
lambda{
|
17
|
+
RSolr.connect(:solr_home=>'')
|
18
|
+
}.should raise_error(RSolr::Direct::Connection::MissingRequiredJavaLibs)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should attempt to use a direct connect if :solr_home is set but raise a InvalidSolrHome' do
|
22
|
+
load_required_java_libs
|
23
|
+
lambda{
|
24
|
+
RSolr.connect(:solr_home=>'')
|
25
|
+
}.should raise_error(RSolr::Direct::Connection::InvalidSolrHome)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should create direct connection succesfully' do
|
29
|
+
load_required_java_libs
|
30
|
+
RSolr.connect(:solr_home=>solr_home_dir).connection.should be_a(RSolr::Direct::Connection)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should accept a Java::OrgApacheSolrCore::SolrCore' do
|
34
|
+
load_required_java_libs
|
35
|
+
core = new_solr_core solr_home_dir, solr_data_dir
|
36
|
+
rsolr = RSolr.connect(core)
|
37
|
+
rsolr.should be_a(RSolr::Client)
|
38
|
+
rsolr.connection.should be_a(RSolr::Direct::Connection)
|
39
|
+
core.close
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should accept a Java::OrgApacheSolrServlet::DirectSolrConnection' do
|
43
|
+
load_required_java_libs
|
44
|
+
dc = new_direct_solr_connection solr_home_dir, solr_data_dir
|
45
|
+
rsolr = RSolr.connect(dc)
|
46
|
+
rsolr.should be_a(RSolr::Client)
|
47
|
+
rsolr.connection.should be_a(RSolr::Direct::Connection)
|
48
|
+
dc.close
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rsolr-direct'
|
4
|
+
require 'spec'
|
5
|
+
require 'spec/autorun'
|
6
|
+
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
|
9
|
+
# returns true/false depending on whether or not JRuby is running
|
10
|
+
def jruby?; defined?(JRUBY_VERSION) end
|
11
|
+
|
12
|
+
# returns absolute path to solr distribution dir
|
13
|
+
def solr_dist_dir
|
14
|
+
File.expand_path(File.join(File.dirname(__FILE__), '..', 'solr'))
|
15
|
+
end
|
16
|
+
|
17
|
+
# returns absolute path to solr home dir
|
18
|
+
def solr_home_dir
|
19
|
+
File.expand_path(File.join(solr_dist_dir, 'example', 'solr'))
|
20
|
+
end
|
21
|
+
|
22
|
+
# returns absolute path to solr data dir
|
23
|
+
def solr_data_dir
|
24
|
+
File.expand_path(File.join(solr_home_dir, 'data'))
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_required_java_libs
|
28
|
+
# $stderr.puts "Loading jar files from #{solr_dist_dir}..."
|
29
|
+
['lib', 'dist'].each do |sub|
|
30
|
+
Dir[File.join(solr_dist_dir, sub, '*.jar')].each do |jar|
|
31
|
+
# $stderr.puts "Loading #{jar}"
|
32
|
+
require jar
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def new_direct_solr_connection solr_home_path, solr_data_path
|
38
|
+
org.apache.solr.servlet.DirectSolrConnection.new(solr_home_path, solr_data_path, nil)
|
39
|
+
end
|
40
|
+
|
41
|
+
# creates a new SolrCore
|
42
|
+
def new_solr_core solr_home_path, solr_data_path
|
43
|
+
|
44
|
+
import org.apache.solr.core.SolrResourceLoader
|
45
|
+
import org.apache.solr.core.CoreContainer
|
46
|
+
import org.apache.solr.core.SolrConfig
|
47
|
+
import org.apache.solr.core.CoreDescriptor
|
48
|
+
import org.apache.solr.schema.IndexSchema
|
49
|
+
import org.apache.solr.core.SolrCore
|
50
|
+
|
51
|
+
config_file = SolrConfig::DEFAULT_CONF_FILE
|
52
|
+
|
53
|
+
resource_loader = SolrResourceLoader.new(solr_home_path)
|
54
|
+
cores = CoreContainer.new(resource_loader)
|
55
|
+
|
56
|
+
solr_config = SolrConfig.new(solr_home_path, config_file, nil)
|
57
|
+
|
58
|
+
dcore = CoreDescriptor.new(cores, "", solr_config.getResourceLoader().getInstanceDir())
|
59
|
+
|
60
|
+
index_schema = IndexSchema.new(solr_config, "#{solr_home_dir}/conf/schema.xml", nil)
|
61
|
+
|
62
|
+
core = SolrCore.new( nil, solr_data_path, solr_config, index_schema, dcore)
|
63
|
+
|
64
|
+
cores.register("", core, false)
|
65
|
+
|
66
|
+
core
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rsolr-direct
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Mitchell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-04 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.9
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rsolr
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.1
|
34
|
+
version:
|
35
|
+
description: Provides a non-http connection to your solr/lucene index
|
36
|
+
email: goodieboy@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- LICENSE
|
46
|
+
- README.rdoc
|
47
|
+
- VERSION
|
48
|
+
- lib/rsolr-direct.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/mwmitchell/rsolr-direct
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.3.5
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: A JRuby, direct connection for RSolr
|
77
|
+
test_files:
|
78
|
+
- spec/rsolr-direct_spec.rb
|
79
|
+
- spec/spec.opts
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- Rakefile
|
82
|
+
- solr/dist/apache-solr-1.4.0.war
|
83
|
+
- solr/dist/apache-solr-cell-1.4.0.jar
|
84
|
+
- solr/dist/apache-solr-clustering-1.4.0.jar
|
85
|
+
- solr/dist/apache-solr-core-1.4.0.jar
|
86
|
+
- solr/dist/apache-solr-dataimporthandler-1.4.0.jar
|
87
|
+
- solr/dist/apache-solr-dataimporthandler-extras-1.4.0.jar
|
88
|
+
- solr/dist/apache-solr-solrj-1.4.0.jar
|
89
|
+
- solr/lib/commons-codec-1.3.jar
|
90
|
+
- solr/lib/commons-csv-1.0-SNAPSHOT-r609327.jar
|
91
|
+
- solr/lib/commons-fileupload-1.2.1.jar
|
92
|
+
- solr/lib/commons-httpclient-3.1.jar
|
93
|
+
- solr/lib/commons-io-1.4.jar
|
94
|
+
- solr/lib/easymock.jar
|
95
|
+
- solr/lib/geronimo-stax-api_1.0_spec-1.0.1.jar
|
96
|
+
- solr/lib/jcl-over-slf4j-1.5.5.jar
|
97
|
+
- solr/lib/junit-4.3.jar
|
98
|
+
- solr/lib/lucene-analyzers-2.9.1.jar
|
99
|
+
- solr/lib/lucene-core-2.9.1.jar
|
100
|
+
- solr/lib/lucene-highlighter-2.9.1.jar
|
101
|
+
- solr/lib/lucene-memory-2.9.1.jar
|
102
|
+
- solr/lib/lucene-misc-2.9.1.jar
|
103
|
+
- solr/lib/lucene-queries-2.9.1.jar
|
104
|
+
- solr/lib/lucene-snowball-2.9.1.jar
|
105
|
+
- solr/lib/lucene-spellchecker-2.9.1.jar
|
106
|
+
- solr/lib/servlet-api-2.4.jar
|
107
|
+
- solr/lib/slf4j-api-1.5.5.jar
|
108
|
+
- solr/lib/slf4j-jdk14-1.5.5.jar
|
109
|
+
- solr/lib/solr-commons-csv-pom.xml.template
|
110
|
+
- solr/lib/wstx-asl-3.2.7.jar
|
111
|
+
- solr/example/solr/README.txt
|