bigindex-solr 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +8 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +73 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bigindex-solr.gemspec +141 -0
- data/examples/bigindex.yml +9 -0
- data/install.rb +17 -0
- data/lib/bigindex-solr.rb +32 -0
- data/lib/bigindex-solr/tasks.rb +3 -0
- data/lib/tasks/bigindex_solr.rake +55 -0
- data/schema.xml +126 -0
- data/solr/CHANGES.txt +562 -0
- data/solr/LICENSE.txt +608 -0
- data/solr/NOTICE.txt +57 -0
- data/solr/etc/jetty.xml +206 -0
- data/solr/etc/webdefault.xml +379 -0
- data/solr/lib/commons-codec-1.3.jar +0 -0
- data/solr/lib/commons-csv-0.1-SNAPSHOT.jar +0 -0
- data/solr/lib/commons-fileupload-1.2.jar +0 -0
- data/solr/lib/commons-io-1.2.jar +0 -0
- data/solr/lib/easymock.jar +0 -0
- data/solr/lib/jetty-6.1.3.jar +0 -0
- data/solr/lib/jetty-util-6.1.3.jar +0 -0
- data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/solr/lib/lucene-analyzers-2007-05-20_00-04-53.jar +0 -0
- data/solr/lib/lucene-core-2007-05-20_00-04-53.jar +0 -0
- data/solr/lib/lucene-highlighter-2007-05-20_00-04-53.jar +0 -0
- data/solr/lib/lucene-snowball-2007-05-20_00-04-53.jar +0 -0
- data/solr/lib/lucene-spellchecker-2007-05-20_00-04-53.jar +0 -0
- data/solr/lib/servlet-api-2.4.jar +0 -0
- data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
- data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
- data/solr/solr/README.txt +52 -0
- data/solr/solr/bin/abc +176 -0
- data/solr/solr/bin/abo +176 -0
- data/solr/solr/bin/backup +108 -0
- data/solr/solr/bin/backupcleaner +142 -0
- data/solr/solr/bin/commit +128 -0
- data/solr/solr/bin/optimize +129 -0
- data/solr/solr/bin/readercycle +129 -0
- data/solr/solr/bin/rsyncd-disable +77 -0
- data/solr/solr/bin/rsyncd-enable +76 -0
- data/solr/solr/bin/rsyncd-start +145 -0
- data/solr/solr/bin/rsyncd-stop +105 -0
- data/solr/solr/bin/scripts-util +83 -0
- data/solr/solr/bin/snapcleaner +148 -0
- data/solr/solr/bin/snapinstaller +168 -0
- data/solr/solr/bin/snappuller +248 -0
- data/solr/solr/bin/snappuller-disable +77 -0
- data/solr/solr/bin/snappuller-enable +77 -0
- data/solr/solr/bin/snapshooter +109 -0
- data/solr/solr/conf/admin-extra.html +31 -0
- data/solr/solr/conf/protwords.txt +21 -0
- data/solr/solr/conf/schema.xml +126 -0
- data/solr/solr/conf/scripts.conf +24 -0
- data/solr/solr/conf/solrconfig.xml +458 -0
- data/solr/solr/conf/stopwords.txt +57 -0
- data/solr/solr/conf/synonyms.txt +31 -0
- data/solr/solr/conf/xslt/example.xsl +132 -0
- data/solr/solr/conf/xslt/example_atom.xsl +63 -0
- data/solr/solr/conf/xslt/example_rss.xsl +62 -0
- data/solr/solr/data/development/index/_a.fdt +0 -0
- data/solr/solr/data/development/index/_a.fdx +0 -0
- data/solr/solr/data/development/index/_a.fnm +2 -0
- data/solr/solr/data/development/index/_a.frq +1 -0
- data/solr/solr/data/development/index/_a.nrm +1 -0
- data/solr/solr/data/development/index/_a.prx +0 -0
- data/solr/solr/data/development/index/_a.tii +0 -0
- data/solr/solr/data/development/index/_a.tis +0 -0
- data/solr/solr/data/development/index/_a_1.del +0 -0
- data/solr/solr/data/development/index/_b.fdt +0 -0
- data/solr/solr/data/development/index/_b.fdx +0 -0
- data/solr/solr/data/development/index/_b.fnm +2 -0
- data/solr/solr/data/development/index/_b.frq +0 -0
- data/solr/solr/data/development/index/_b.nrm +1 -0
- data/solr/solr/data/development/index/_b.prx +0 -0
- data/solr/solr/data/development/index/_b.tii +0 -0
- data/solr/solr/data/development/index/_b.tis +0 -0
- data/solr/solr/data/development/index/_b_1.del +0 -0
- data/solr/solr/data/development/index/_c.fdt +0 -0
- data/solr/solr/data/development/index/_c.fdx +0 -0
- data/solr/solr/data/development/index/_c.fnm +2 -0
- data/solr/solr/data/development/index/_c.frq +1 -0
- data/solr/solr/data/development/index/_c.nrm +1 -0
- data/solr/solr/data/development/index/_c.prx +0 -0
- data/solr/solr/data/development/index/_c.tii +0 -0
- data/solr/solr/data/development/index/_c.tis +0 -0
- data/solr/solr/data/development/index/_c_1.del +0 -0
- data/solr/solr/data/development/index/segments.gen +0 -0
- data/solr/solr/data/development/index/segments_q +0 -0
- data/solr/start.jar +0 -0
- data/solr/webapps/solr.war +0 -0
- data/spec/bigindex-solr_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- metadata +163 -0
data/.document
ADDED
data/.gitignore
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 openplaces.org
|
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,73 @@
|
|
1
|
+
= Bigindex-Solr
|
2
|
+
|
3
|
+
Add the power of the Solr search server to your Rails application with this easy to use gem.
|
4
|
+
|
5
|
+
This is meant to be used with Bigindex [http://github.com/openplaces/bigindex] in order to provide indexing functionality to your Rails application.
|
6
|
+
|
7
|
+
The version of this project corresponds to the version of Solr that's packaged along with it.
|
8
|
+
|
9
|
+
== Requirements
|
10
|
+
|
11
|
+
* This gem requires that your system have Java 1.6+ installed and working properly. It also requires that the command line app "java" be accessible from the account you're trying to run this from.
|
12
|
+
* Although it's not required to get this gem working, Bigindex should be installed and working with your Rails application in order to actually interface with Solr. You could of course install this package standalone if all you wanted was Solr.
|
13
|
+
|
14
|
+
== Usage
|
15
|
+
|
16
|
+
(1) Add the following line to your RAILS_ROOT/config/environment.rb
|
17
|
+
|
18
|
+
config.gem "bigindex-solr", :source => "http://gemcutter.org"
|
19
|
+
|
20
|
+
(2) Add the following line to the bottom of your RAILS_ROOT/Rakefile
|
21
|
+
|
22
|
+
require 'bigindex-solr/tasks'
|
23
|
+
|
24
|
+
(3) Run the following rake task to generate a config for your Rails application
|
25
|
+
|
26
|
+
rake bigindex:solr:generate_config
|
27
|
+
|
28
|
+
(4) Modify RAILS_ROOT/config/bigindex.yml to start up on a specified port of your choice
|
29
|
+
|
30
|
+
(5) Start up your Solr server
|
31
|
+
|
32
|
+
rake bigindex:solr:start
|
33
|
+
|
34
|
+
(6) Stop your Solr server when you're done
|
35
|
+
|
36
|
+
rake bigindex:solr:stop
|
37
|
+
|
38
|
+
== Alternate usage
|
39
|
+
|
40
|
+
You can also install Bigindex-Solr as a plugin by running:
|
41
|
+
|
42
|
+
script/plugin install git://github.com/openplaces/bigindex-solr.git
|
43
|
+
|
44
|
+
and continuing with step (4) in the previous section.
|
45
|
+
|
46
|
+
== Advanced configurations
|
47
|
+
|
48
|
+
It's possible to define what JVM options to start up Solr with. Just edit the RAILS_ROOT/config/bigindex.yml similarly to this:
|
49
|
+
|
50
|
+
development:
|
51
|
+
adapter: solr
|
52
|
+
solr_url: http://localhost:8981/solr
|
53
|
+
jvm_options: -Xms64m -Xmx512m
|
54
|
+
|
55
|
+
== Note on Patches/Pull Requests
|
56
|
+
|
57
|
+
* Fork the project.
|
58
|
+
* Make your feature addition or bug fix.
|
59
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
60
|
+
* Commit, do not mess with rakefile, version, or history. (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)
|
61
|
+
* Send me a pull request. Bonus points for topic branches.
|
62
|
+
|
63
|
+
== Credits
|
64
|
+
|
65
|
+
This project was derived from acts_as_solr
|
66
|
+
|
67
|
+
== LICENSE
|
68
|
+
|
69
|
+
This project is released under the MIT license.
|
70
|
+
|
71
|
+
== Copyright
|
72
|
+
|
73
|
+
Copyright (c) 2009 openplaces.org. See MIT-LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "bigindex-solr"
|
8
|
+
gem.summary = %Q{Bootstraps the Solr search server into your Rails application for use with Bigindex. Gem version is based on the Solr version packaged.}
|
9
|
+
gem.description = %Q{Solr is an Apache open-source search server based on Lucene Java. This project aims to integrate Solr into your Rails application to work with Bigindex [http://github.com/openplaces/bigindex]}
|
10
|
+
gem.email = "bigrecord@openplaces.org"
|
11
|
+
gem.homepage = "http://bigrecord.org"
|
12
|
+
gem.authors = ["openplaces.org"]
|
13
|
+
gem.add_development_dependency "rspec"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
if File.exist?('VERSION')
|
40
|
+
version = File.read('VERSION')
|
41
|
+
else
|
42
|
+
version = ""
|
43
|
+
end
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "bigindex-solr #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.2.0
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{bigindex-solr}
|
8
|
+
s.version = "1.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["openplaces.org"]
|
12
|
+
s.date = %q{2009-10-15}
|
13
|
+
s.description = %q{Solr is an Apache open-source search server based on Lucene Java. This project aims to integrate Solr into your Rails application to work with Bigindex [http://github.com/openplaces/bigindex]}
|
14
|
+
s.email = %q{bigrecord@openplaces.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".document",
|
20
|
+
".gitignore",
|
21
|
+
"MIT-LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bigindex-solr.gemspec",
|
26
|
+
"examples/bigindex.yml",
|
27
|
+
"install.rb",
|
28
|
+
"lib/bigindex-solr.rb",
|
29
|
+
"lib/bigindex-solr/tasks.rb",
|
30
|
+
"lib/tasks/bigindex_solr.rake",
|
31
|
+
"schema.xml",
|
32
|
+
"solr/CHANGES.txt",
|
33
|
+
"solr/LICENSE.txt",
|
34
|
+
"solr/NOTICE.txt",
|
35
|
+
"solr/etc/jetty.xml",
|
36
|
+
"solr/etc/webdefault.xml",
|
37
|
+
"solr/lib/commons-codec-1.3.jar",
|
38
|
+
"solr/lib/commons-csv-0.1-SNAPSHOT.jar",
|
39
|
+
"solr/lib/commons-fileupload-1.2.jar",
|
40
|
+
"solr/lib/commons-io-1.2.jar",
|
41
|
+
"solr/lib/easymock.jar",
|
42
|
+
"solr/lib/jetty-6.1.3.jar",
|
43
|
+
"solr/lib/jetty-util-6.1.3.jar",
|
44
|
+
"solr/lib/jsp-2.1/ant-1.6.5.jar",
|
45
|
+
"solr/lib/jsp-2.1/core-3.1.1.jar",
|
46
|
+
"solr/lib/jsp-2.1/jsp-2.1.jar",
|
47
|
+
"solr/lib/jsp-2.1/jsp-api-2.1.jar",
|
48
|
+
"solr/lib/lucene-analyzers-2007-05-20_00-04-53.jar",
|
49
|
+
"solr/lib/lucene-core-2007-05-20_00-04-53.jar",
|
50
|
+
"solr/lib/lucene-highlighter-2007-05-20_00-04-53.jar",
|
51
|
+
"solr/lib/lucene-snowball-2007-05-20_00-04-53.jar",
|
52
|
+
"solr/lib/lucene-spellchecker-2007-05-20_00-04-53.jar",
|
53
|
+
"solr/lib/servlet-api-2.4.jar",
|
54
|
+
"solr/lib/servlet-api-2.5-6.1.3.jar",
|
55
|
+
"solr/lib/xpp3-1.1.3.4.O.jar",
|
56
|
+
"solr/solr/README.txt",
|
57
|
+
"solr/solr/bin/abc",
|
58
|
+
"solr/solr/bin/abo",
|
59
|
+
"solr/solr/bin/backup",
|
60
|
+
"solr/solr/bin/backupcleaner",
|
61
|
+
"solr/solr/bin/commit",
|
62
|
+
"solr/solr/bin/optimize",
|
63
|
+
"solr/solr/bin/readercycle",
|
64
|
+
"solr/solr/bin/rsyncd-disable",
|
65
|
+
"solr/solr/bin/rsyncd-enable",
|
66
|
+
"solr/solr/bin/rsyncd-start",
|
67
|
+
"solr/solr/bin/rsyncd-stop",
|
68
|
+
"solr/solr/bin/scripts-util",
|
69
|
+
"solr/solr/bin/snapcleaner",
|
70
|
+
"solr/solr/bin/snapinstaller",
|
71
|
+
"solr/solr/bin/snappuller",
|
72
|
+
"solr/solr/bin/snappuller-disable",
|
73
|
+
"solr/solr/bin/snappuller-enable",
|
74
|
+
"solr/solr/bin/snapshooter",
|
75
|
+
"solr/solr/conf/admin-extra.html",
|
76
|
+
"solr/solr/conf/protwords.txt",
|
77
|
+
"solr/solr/conf/schema.xml",
|
78
|
+
"solr/solr/conf/scripts.conf",
|
79
|
+
"solr/solr/conf/solrconfig.xml",
|
80
|
+
"solr/solr/conf/stopwords.txt",
|
81
|
+
"solr/solr/conf/synonyms.txt",
|
82
|
+
"solr/solr/conf/xslt/example.xsl",
|
83
|
+
"solr/solr/conf/xslt/example_atom.xsl",
|
84
|
+
"solr/solr/conf/xslt/example_rss.xsl",
|
85
|
+
"solr/solr/data/development/index/_a.fdt",
|
86
|
+
"solr/solr/data/development/index/_a.fdx",
|
87
|
+
"solr/solr/data/development/index/_a.fnm",
|
88
|
+
"solr/solr/data/development/index/_a.frq",
|
89
|
+
"solr/solr/data/development/index/_a.nrm",
|
90
|
+
"solr/solr/data/development/index/_a.prx",
|
91
|
+
"solr/solr/data/development/index/_a.tii",
|
92
|
+
"solr/solr/data/development/index/_a.tis",
|
93
|
+
"solr/solr/data/development/index/_a_1.del",
|
94
|
+
"solr/solr/data/development/index/_b.fdt",
|
95
|
+
"solr/solr/data/development/index/_b.fdx",
|
96
|
+
"solr/solr/data/development/index/_b.fnm",
|
97
|
+
"solr/solr/data/development/index/_b.frq",
|
98
|
+
"solr/solr/data/development/index/_b.nrm",
|
99
|
+
"solr/solr/data/development/index/_b.prx",
|
100
|
+
"solr/solr/data/development/index/_b.tii",
|
101
|
+
"solr/solr/data/development/index/_b.tis",
|
102
|
+
"solr/solr/data/development/index/_b_1.del",
|
103
|
+
"solr/solr/data/development/index/_c.fdt",
|
104
|
+
"solr/solr/data/development/index/_c.fdx",
|
105
|
+
"solr/solr/data/development/index/_c.fnm",
|
106
|
+
"solr/solr/data/development/index/_c.frq",
|
107
|
+
"solr/solr/data/development/index/_c.nrm",
|
108
|
+
"solr/solr/data/development/index/_c.prx",
|
109
|
+
"solr/solr/data/development/index/_c.tii",
|
110
|
+
"solr/solr/data/development/index/_c.tis",
|
111
|
+
"solr/solr/data/development/index/_c_1.del",
|
112
|
+
"solr/solr/data/development/index/segments.gen",
|
113
|
+
"solr/solr/data/development/index/segments_q",
|
114
|
+
"solr/start.jar",
|
115
|
+
"solr/webapps/solr.war",
|
116
|
+
"spec/bigindex-solr_spec.rb",
|
117
|
+
"spec/spec_helper.rb"
|
118
|
+
]
|
119
|
+
s.homepage = %q{http://bigrecord.org}
|
120
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
121
|
+
s.require_paths = ["lib"]
|
122
|
+
s.rubygems_version = %q{1.3.5}
|
123
|
+
s.summary = %q{Bootstraps the Solr search server into your Rails application for use with Bigindex. Gem version is based on the Solr version packaged.}
|
124
|
+
s.test_files = [
|
125
|
+
"spec/bigindex-solr_spec.rb",
|
126
|
+
"spec/spec_helper.rb"
|
127
|
+
]
|
128
|
+
|
129
|
+
if s.respond_to? :specification_version then
|
130
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
131
|
+
s.specification_version = 3
|
132
|
+
|
133
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
134
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
135
|
+
else
|
136
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
137
|
+
end
|
138
|
+
else
|
139
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
140
|
+
end
|
141
|
+
end
|
data/install.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
puts "[Bigindex-Solr] Copying example config file to your RAILS_ROOT...\n"
|
4
|
+
|
5
|
+
config_dir = File.join(RAILS_ROOT, "config")
|
6
|
+
source = File.join(File.dirname(__FILE__), "examples", "bigindex.yml")
|
7
|
+
target = File.join(config_dir, "bigindex.yml")
|
8
|
+
alternate_target = File.join(config_dir, "bigindex.yml.sample")
|
9
|
+
|
10
|
+
if !File.exist?(target)
|
11
|
+
FileUtils.cp(source, target)
|
12
|
+
else
|
13
|
+
puts "[Bigindex-Solr] RAILS_ROOT/config/bigindex.yml file already exists. Copying it as bigindex.yml.sample for reference."
|
14
|
+
FileUtils.cp(source, alternate_target)
|
15
|
+
end
|
16
|
+
|
17
|
+
FileUtils.mkdir_p(File.join(RAILS_ROOT, "solr"))
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module BigindexSolr
|
5
|
+
|
6
|
+
ENVIRONMENT = (ENV['RAILS_ENV'] || 'development').dup
|
7
|
+
|
8
|
+
PID_PATH = File.join(RAILS_ROOT, "tmp", "pids")
|
9
|
+
LOGS_PATH = File.join(RAILS_ROOT, "log")
|
10
|
+
DATA_PATH = File.join(RAILS_ROOT, "solr", ENVIRONMENT)
|
11
|
+
SOLR_PATH = File.join(File.dirname(__FILE__), "..", "solr")
|
12
|
+
|
13
|
+
FileUtils.mkdir_p(DATA_PATH)
|
14
|
+
|
15
|
+
CONFIG_PATH = File.join(RAILS_ROOT, "config", "bigindex.yml")
|
16
|
+
|
17
|
+
begin
|
18
|
+
CONFIG = YAML::load_file(CONFIG_PATH)
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
raise LoadError, "[Bigindex-Solr] Could not read config file: #{CONFIG_PATH}. Please check that it exists!"
|
21
|
+
CONFIG = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
raise LoadError, "[Bigindex-Solr] The adapter defined for environment: #{ENVIRONMENT} is not solr" unless CONFIG[ENVIRONMENT]['adapter'] == "solr"
|
25
|
+
|
26
|
+
unless CONFIG.empty? || CONFIG[ENVIRONMENT].nil?
|
27
|
+
URL = CONFIG[ENVIRONMENT]['solr_url']
|
28
|
+
PORT = URI.parse(URL).port
|
29
|
+
JVM_OPTIONS = CONFIG[ENVIRONMENT]['jvm_options'] || ""
|
30
|
+
end
|
31
|
+
|
32
|
+
end # module BigindexSolr
|
@@ -0,0 +1,55 @@
|
|
1
|
+
namespace :bigindex do
|
2
|
+
namespace :solr do
|
3
|
+
|
4
|
+
desc 'Generates a bigindex.yml config file and places it into your RAILS_ROOT/config folder. Creates bigindex.yml.sample if the file already exists.'
|
5
|
+
task :generate_config do
|
6
|
+
require File.join(File.dirname(__FILE__), "..", "..", "install.rb")
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Starts Solr. Options accepted: RAILS_ENV=your_env, PORT=XX. Defaults to development if none.'
|
10
|
+
task :start do
|
11
|
+
require 'net/http'
|
12
|
+
|
13
|
+
unless defined?(BigindexSolr)
|
14
|
+
require File.join(File.dirname(__FILE__), "..", "bigindex-solr")
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
n = Net::HTTP.new('127.0.0.1', BigindexSolr::PORT)
|
19
|
+
n.request_head('/').value
|
20
|
+
|
21
|
+
rescue Net::HTTPServerException #responding
|
22
|
+
puts "Port #{BigindexSolr::PORT} in use" and return
|
23
|
+
|
24
|
+
rescue Errno::ECONNREFUSED #not responding
|
25
|
+
Dir.chdir(BigindexSolr::SOLR_PATH) do
|
26
|
+
pid = fork do
|
27
|
+
exec "java #{BigindexSolr::JVM_OPTIONS} -Dsolr.data.dir=#{BigindexSolr::DATA_PATH} -Djetty.logs=#{BigindexSolr::LOGS_PATH} -Djetty.port=#{BigindexSolr::PORT} -jar start.jar"
|
28
|
+
end
|
29
|
+
sleep(5)
|
30
|
+
File.open("#{BigindexSolr::PID_PATH}/#{BigindexSolr::ENVIRONMENT}_pid", "w"){ |f| f << pid}
|
31
|
+
puts "[#{BigindexSolr::ENVIRONMENT}] Solr started successfully on #{BigindexSolr::PORT}, pid: #{pid}."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Stops Solr. Specify the environment by using: RAILS_ENV=your_env. Defaults to development if none.'
|
37
|
+
task :stop do
|
38
|
+
unless defined?(BigindexSolr)
|
39
|
+
require File.join(File.dirname(__FILE__), "..", "bigindex-solr")
|
40
|
+
end
|
41
|
+
|
42
|
+
file_path = "#{BigindexSolr::PID_PATH}/#{BigindexSolr::ENVIRONMENT}_pid"
|
43
|
+
if File.exists?(file_path)
|
44
|
+
pid = File.open(file_path, "r").readline.to_i
|
45
|
+
Process.kill("TERM", pid)
|
46
|
+
sleep(2)
|
47
|
+
File.unlink(file_path)
|
48
|
+
puts "[#{BigindexSolr::ENVIRONMENT}] Solr shutdown successfully."
|
49
|
+
else
|
50
|
+
puts "PID file not found at #{file_path}. Either Solr is not running or no PID file was written."
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end # namespace :solr
|
55
|
+
end # namespace :bigindex
|
data/schema.xml
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
|
19
|
+
<!--
|
20
|
+
This is the Solr schema file. This file should be named "schema.xml" and
|
21
|
+
should be in the conf directory under the solr home
|
22
|
+
(i.e. ./solr/conf/schema.xml by default)
|
23
|
+
or located where the classloader for the Solr webapp can find it.
|
24
|
+
|
25
|
+
This example schema is the recommended starting point for users.
|
26
|
+
It should be kept correct and concise, usable out-of-the-box.
|
27
|
+
|
28
|
+
For more information, on how to customize this file, please see
|
29
|
+
http://wiki.apache.org/solr/SchemaXml
|
30
|
+
-->
|
31
|
+
|
32
|
+
<schema name="bigindex_solr" version="0.9">
|
33
|
+
<types>
|
34
|
+
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="false"/>
|
35
|
+
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="false"/>
|
36
|
+
<fieldType name="integer" class="solr.IntField" omitNorms="false"/>
|
37
|
+
<fieldType name="long" class="solr.LongField" omitNorms="false"/>
|
38
|
+
<fieldType name="float" class="solr.FloatField" omitNorms="false"/>
|
39
|
+
<fieldType name="double" class="solr.DoubleField" omitNorms="false"/>
|
40
|
+
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="false"/>
|
41
|
+
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="false"/>
|
42
|
+
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="false"/>
|
43
|
+
<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="false"/>
|
44
|
+
<fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="false"/>
|
45
|
+
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
|
46
|
+
<analyzer>
|
47
|
+
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
48
|
+
</analyzer>
|
49
|
+
</fieldType>
|
50
|
+
|
51
|
+
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
|
52
|
+
<analyzer type="index">
|
53
|
+
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
54
|
+
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
55
|
+
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
|
56
|
+
<filter class="solr.LowerCaseFilterFactory"/>
|
57
|
+
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
|
58
|
+
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
59
|
+
</analyzer>
|
60
|
+
<analyzer type="query">
|
61
|
+
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
62
|
+
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
63
|
+
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
64
|
+
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
|
65
|
+
<filter class="solr.LowerCaseFilterFactory"/>
|
66
|
+
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
|
67
|
+
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
68
|
+
</analyzer>
|
69
|
+
</fieldType>
|
70
|
+
|
71
|
+
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
|
72
|
+
<analyzer>
|
73
|
+
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
74
|
+
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
|
75
|
+
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
76
|
+
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
|
77
|
+
<filter class="solr.LowerCaseFilterFactory"/>
|
78
|
+
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
|
79
|
+
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
80
|
+
</analyzer>
|
81
|
+
</fieldType>
|
82
|
+
|
83
|
+
<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="false">
|
84
|
+
<analyzer>
|
85
|
+
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
86
|
+
<filter class="solr.LowerCaseFilterFactory" />
|
87
|
+
<filter class="solr.TrimFilterFactory" />
|
88
|
+
<filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z])" replacement="" replace="all"/>
|
89
|
+
</analyzer>
|
90
|
+
</fieldType>
|
91
|
+
|
92
|
+
<fieldtype name="text_zh" class="solr.TextField">
|
93
|
+
<analyzer class="org.apache.lucene.analysis.cn.ChineseAnalyzer"/>
|
94
|
+
</fieldtype>
|
95
|
+
|
96
|
+
</types>
|
97
|
+
|
98
|
+
|
99
|
+
<fields>
|
100
|
+
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
101
|
+
<field name="pk_i" type="integer" indexed="true" stored="true"/>
|
102
|
+
<field name="pk_s" type="string" indexed="true" stored="true"/>
|
103
|
+
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
|
104
|
+
|
105
|
+
<dynamicField name="*_i" type="integer" indexed="true" stored="false"/>
|
106
|
+
<dynamicField name="*_t" type="text" indexed="true" stored="false"/>
|
107
|
+
<dynamicField name="*_f" type="float" indexed="true" stored="false"/>
|
108
|
+
<dynamicField name="*_b" type="boolean" indexed="true" stored="false"/>
|
109
|
+
<dynamicField name="*_d" type="date" indexed="true" stored="false"/>
|
110
|
+
<dynamicField name="*_s" type="string" indexed="true" stored="false"/>
|
111
|
+
<dynamicField name="*_ri" type="sint" indexed="true" stored="false"/>
|
112
|
+
<dynamicField name="*_rf" type="sfloat" indexed="true" stored="false"/>
|
113
|
+
<dynamicField name="*_facet" type="string" indexed="true" stored="false"/>
|
114
|
+
<dynamicField name="*_s_mv" type="string" indexed="true" stored="false" multiValued="true"/>
|
115
|
+
<dynamicField name="*_zh_text" type="text_zh" indexed="true" stored="false" multiValued="true"/>
|
116
|
+
<dynamicField name="*_display" type="text" indexed="false" stored="true" multiValued="true"/>
|
117
|
+
</fields>
|
118
|
+
|
119
|
+
<uniqueKey>id</uniqueKey>
|
120
|
+
<defaultSearchField>text</defaultSearchField>
|
121
|
+
|
122
|
+
<copyField source="*_t" dest="text"/>
|
123
|
+
<copyField source="*_facet" dest="text"/>
|
124
|
+
<solrQueryParser defaultOperator="AND"/>
|
125
|
+
|
126
|
+
</schema>
|