sunspot_solr-jts 2.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +30 -0
  6. data/Gemfile +3 -0
  7. data/README.rdoc +30 -0
  8. data/Rakefile +1 -0
  9. data/bin/sunspot-installer +20 -0
  10. data/bin/sunspot-solr +80 -0
  11. data/lib/sunspot/solr/installer/config_installer.rb +53 -0
  12. data/lib/sunspot/solr/installer/task_helper.rb +13 -0
  13. data/lib/sunspot/solr/installer.rb +25 -0
  14. data/lib/sunspot/solr/java.rb +13 -0
  15. data/lib/sunspot/solr/railtie.rb +15 -0
  16. data/lib/sunspot/solr/server.rb +225 -0
  17. data/lib/sunspot/solr/tasks.rb +44 -0
  18. data/lib/sunspot/solr/version.rb +5 -0
  19. data/lib/sunspot_solr-jts.rb +5 -0
  20. data/lib/sunspot_solr.rb +1 -0
  21. data/solr/README.txt +42 -0
  22. data/solr/contexts/solr.xml +7 -0
  23. data/solr/etc/jetty.xml +167 -0
  24. data/solr/etc/webdefault.xml +527 -0
  25. data/solr/lib/jetty-continuation-8.1.8.v20121106.jar +0 -0
  26. data/solr/lib/jetty-deploy-8.1.8.v20121106.jar +0 -0
  27. data/solr/lib/jetty-http-8.1.8.v20121106.jar +0 -0
  28. data/solr/lib/jetty-io-8.1.8.v20121106.jar +0 -0
  29. data/solr/lib/jetty-jmx-8.1.8.v20121106.jar +0 -0
  30. data/solr/lib/jetty-security-8.1.8.v20121106.jar +0 -0
  31. data/solr/lib/jetty-server-8.1.8.v20121106.jar +0 -0
  32. data/solr/lib/jetty-servlet-8.1.8.v20121106.jar +0 -0
  33. data/solr/lib/jetty-util-8.1.8.v20121106.jar +0 -0
  34. data/solr/lib/jetty-webapp-8.1.8.v20121106.jar +0 -0
  35. data/solr/lib/jetty-xml-8.1.8.v20121106.jar +0 -0
  36. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  37. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  38. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  39. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  40. data/solr/lib/servlet-api-3.0.jar +0 -0
  41. data/solr/solr/.gitignore +1 -0
  42. data/solr/solr/conf/admin-extra.html +31 -0
  43. data/solr/solr/conf/elevate.xml +36 -0
  44. data/solr/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  45. data/solr/solr/conf/protwords.txt +21 -0
  46. data/solr/solr/conf/schema.xml +275 -0
  47. data/solr/solr/conf/scripts.conf +24 -0
  48. data/solr/solr/conf/solrconfig.xml +680 -0
  49. data/solr/solr/conf/spellings.txt +2 -0
  50. data/solr/solr/conf/stopwords.txt +58 -0
  51. data/solr/solr/conf/synonyms.txt +31 -0
  52. data/solr/solr/conf/xslt/example.xsl +132 -0
  53. data/solr/solr/conf/xslt/example_atom.xsl +67 -0
  54. data/solr/solr/conf/xslt/example_rss.xsl +66 -0
  55. data/solr/solr/conf/xslt/luke.xsl +337 -0
  56. data/solr/solr/default/README.txt +54 -0
  57. data/solr/solr/solr.xml +8 -0
  58. data/solr/start.jar +0 -0
  59. data/solr/webapps/solr.war +0 -0
  60. data/spec/server_spec.rb +98 -0
  61. data/spec/spec_helper.rb +18 -0
  62. data/sunspot_solr-jts.gemspec +38 -0
  63. metadata +163 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b503a6027e02e7babe92f5f057516fa848d710d6
4
+ data.tar.gz: 6da3a8d00de375e3aabb94f208cafaac693234ee
5
+ SHA512:
6
+ metadata.gz: 42ce72c83fdd381297ed0033a0f50d178daf15d5919f8e8964308c21e01a34510c1907ffd66a60fdd753994533611a4610627999734f9a41a0df482251995314
7
+ data.tar.gz: b018aad6a608d7e185a614a4504632037a8a979536dcc75c47606c2aa46507a85f4e2c6a10f814066571422c14570fea61d7c56a1411bda74c86163f9fe667d7
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ vendor/bundle
4
+ sunspot/vendor/bundle
5
+ sunspot_rails/spec/rails2/vendor
6
+ sunspot_rails/spec/rails3/vendor
7
+ **/*/vendor/bundle
8
+ sunspot-solr.pid
9
+ sunspot_solr/solr/solr-webapp
10
+ .yardoc
11
+ docs
12
+ *.swp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ sunspot_solr-jts
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,30 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+ # - rbx-2.0
5
+ # - jruby
6
+
7
+ env:
8
+ - GEM=sunspot
9
+ - GEM=sunspot_rails RAILS=3.0.0
10
+ - GEM=sunspot_rails RAILS=3.1.0
11
+ - GEM=sunspot_rails RAILS=3.2.0
12
+ - GEM=sunspot_rails RAILS=4.0.0
13
+
14
+ # Limit the size of the matrix by only performing the most common builds
15
+ matrix:
16
+ exclude:
17
+ # Not supporting Ruby 2.0 and Rails < 3
18
+ - rvm: 2.0.0
19
+ env: GEM=sunspot_rails RAILS=3.0.0
20
+ - rvm: 2.0.0
21
+ env: GEM=sunspot_rails RAILS=3.1.0
22
+ allow_failures:
23
+ # SQLITE fails to load correctly on Travis in Ruby 2.0
24
+ - rvm: 2.0.0
25
+ env: GEM=sunspot_rails RAILS=3.2.0
26
+ - rvm: 2.0.0
27
+ env: GEM=sunspot_rails RAILS=4.0.0
28
+
29
+ script:
30
+ - ci/travis.sh
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,30 @@
1
+ = Sunspot::Solr
2
+
3
+ This gem bundles Sunspot::Solr[https://github.com/outoftime/sunspot/tree/master/sunspot_solr] with
4
+ the JTS[http://sourceforge.net/projects/jts-topo-suite/] Java Tology Suite, allowing the
5
+ use of SpatialRecursivePrefixTreeFieldType for multi-value location searches.
6
+
7
+ JTS is licensed under the LGPL v2.1.
8
+
9
+ Sunspot::Solr is a packaged distribution of Solr for use with the
10
+ Sunspot[http://outoftime.github.com/sunspot] and
11
+ Sunspot::Rails[https://github.com/outoftime/sunspot/tree/master/sunspot_rails]
12
+ gems. See those gems' documentation for more information.
13
+
14
+ == Installation
15
+
16
+ gem install sunspot_solr
17
+
18
+ In order to start the daemon, run:
19
+
20
+ sunspot-solr start -- [-d /path/to/data/directory] [-b ip4_address] [-p port] [-s path/to/solr/home] [--pid-dir=path/to/pid/dir]
21
+
22
+ If you don't specify a data directory, your Solr index will be stored in your
23
+ operating system's temporary directory.
24
+
25
+ If you specify a solr home, the directory must contain a <code>conf</code>
26
+ directory, which should contain at least <code>schema.xml</code> and
27
+ <code>solrconfig.xml</code>. Be sure to copy the <code>schema.xml</code> out of
28
+ the Sunspot gem's <code>solr/solr/conf</code> directory. Sunspot relies on the
29
+ field name patterns defined in the packaged <code>schema.xml</code>, so those
30
+ cannot be modified.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'solr', 'installer')
5
+
6
+ home = ARGV.select { |arg| arg !~ /^-/ }.last || File.join(Dir.pwd, "solr")
7
+ options = {}
8
+
9
+ OptionParser.new do |opts|
10
+ opts.banner = "Usage: sunspot-installer [options] [solr-home]"
11
+ opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
12
+ options[:verbose] = v
13
+ end
14
+ opts.on('-f', '--[no-]force', 'Overwrite schema and solrconfig files with Sunspot default, instead of modifying them (recommended for new Solr installation)') do |f|
15
+ options[:force] = f
16
+ end
17
+ end.parse!
18
+
19
+ Sunspot::Solr::Installer.execute(home, options)
20
+ puts "Installed to #{home}"
data/bin/sunspot-solr ADDED
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require 'fileutils'
4
+ require 'tempfile'
5
+ require 'tmpdir'
6
+ require 'optparse'
7
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'solr', 'server')
8
+ rescue LoadError => e
9
+ if require 'rubygems'
10
+ retry
11
+ else
12
+ raise(e)
13
+ end
14
+ end
15
+
16
+ server = Sunspot::Solr::Server.new
17
+
18
+ opts = OptionParser.new do |opts|
19
+ opts.banner = "Usage: sunspot-solr (start|stop|run) [options]"
20
+
21
+ opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
22
+ server.port = p
23
+ end
24
+
25
+ opts.on '-b', '--bind-address=address', 'Interface on which to run Solr (default 0.0.0.0)' do |b|
26
+ server.bind_address = b
27
+ end
28
+
29
+ opts.on '-d', '--data-directory=DIRECTORY', 'Solr data directory' do |d|
30
+ server.solr_data_dir = File.expand_path(d)
31
+ end
32
+
33
+ opts.on '-s', '--solr-home=HOME', 'Solr home directory (should contain conf/ directory)' do |s|
34
+ server.solr_home = File.expand_path(s)
35
+ end
36
+
37
+ opts.on '-j', '--solr-jar=JAR', 'Solr start jar' do |j|
38
+ server.solr_jar = File.expand_path(j)
39
+ end
40
+
41
+ opts.on '--pid-dir=PID_DIR', 'Directory for pid files' do |pd|
42
+ server.pid_dir = File.expand_path(pd)
43
+ end
44
+
45
+ opts.on '-l', '--log-level=LOG_LEVEL', 'Solr logging level' do |l|
46
+ server.log_level = l
47
+ end
48
+
49
+ opts.on '--log-file=LOG_FILE', 'Path to Solr log file' do |lf|
50
+ server.log_file = File.expand_path(lf)
51
+ end
52
+
53
+ opts.on '--max-memory=MEMORY', 'Specify the maximum size of the memory allocation pool' do |mm|
54
+ server.max_memory = mm
55
+ end
56
+
57
+ opts.on '--min-memory=MEMORY', 'Specify the initial size of the memory allocation pool' do |mm|
58
+ server.min_memory = mm
59
+ end
60
+ end
61
+
62
+ opts.parse!
63
+
64
+ begin
65
+ case ARGV[0]
66
+ when 'start'
67
+ server.start
68
+ when 'run'
69
+ server.run
70
+ when 'stop'
71
+ server.stop
72
+ when 'restart'
73
+ server.stop
74
+ server.start
75
+ else
76
+ abort(opts.help)
77
+ end
78
+ rescue Sunspot::Solr::Server::ServerError => e
79
+ abort(e.message)
80
+ end
@@ -0,0 +1,53 @@
1
+ require 'fileutils'
2
+
3
+ module Sunspot
4
+ module Solr
5
+ class Installer
6
+ class ConfigInstaller
7
+ include TaskHelper
8
+
9
+ class <<self
10
+ def execute(config_path, options = {})
11
+ new(config_path, options).execute
12
+ end
13
+ end
14
+
15
+ def initialize(config_path, options)
16
+ @config_path = config_path
17
+ @verbose = !!options[:verbose]
18
+ @force = !!options[:force]
19
+ end
20
+
21
+ def execute
22
+ sunspot_config_path = File.join(File.dirname(__FILE__), '..', '..',
23
+ '..', '..', 'solr', 'solr', 'conf')
24
+ return if File.expand_path(sunspot_config_path) == File.expand_path(@config_path)
25
+
26
+ FileUtils.mkdir_p(@config_path)
27
+ Dir.glob(File.join(sunspot_config_path, '*.*')).each do |file|
28
+ file = File.expand_path(file)
29
+ dest = File.join(@config_path, File.basename(file))
30
+
31
+ if File.exist?(dest)
32
+ if @force
33
+ say("Removing existing file #{dest}")
34
+ else
35
+ next
36
+ end
37
+ end
38
+
39
+ say("Copying #{file} => #{dest}")
40
+ FileUtils.cp(file, dest)
41
+ end
42
+
43
+ # Also copy the solr.xml file for multi core support
44
+ file = File.expand_path('../solr.xml', sunspot_config_path)
45
+ dest = File.expand_path(File.join(@config_path, ".."), File.basename(file))
46
+ say("Copying #{file} => #{dest}")
47
+ FileUtils.cp(file, dest)
48
+
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,13 @@
1
+ module Sunspot
2
+ module Solr
3
+ class Installer
4
+ module TaskHelper
5
+ def say(message)
6
+ if @verbose
7
+ STDOUT.puts(message)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ %w(task_helper config_installer).each do |file|
2
+ require File.join(File.dirname(__FILE__), 'installer', file)
3
+ end
4
+
5
+ module Sunspot
6
+ module Solr
7
+ class Installer
8
+ class <<self
9
+ def execute(solr_home, options = {})
10
+ new(solr_home, options).execute
11
+ end
12
+
13
+ private :new
14
+ end
15
+
16
+ def initialize(solr_home, options)
17
+ @solr_home, @options = solr_home, options
18
+ end
19
+
20
+ def execute
21
+ ConfigInstaller.execute(File.join(@solr_home, 'conf'), @options)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ require 'rbconfig'
2
+
3
+ module Sunspot
4
+ module Solr
5
+ module Java
6
+ NULL_DEVICE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL' : '/dev/null'
7
+
8
+ def self.installed?
9
+ system "java -version >#{NULL_DEVICE} 2>&1"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Sunspot
2
+ module Solr
3
+ class Railtie < ::Rails::Railtie
4
+
5
+ rake_tasks do
6
+ load 'sunspot/solr/tasks.rb'
7
+ end
8
+
9
+ # generators do
10
+ # load "generators/sunspot_rails.rb"
11
+ # end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,225 @@
1
+ require 'set'
2
+ require 'tempfile'
3
+ require 'sunspot/solr/java'
4
+ require 'sunspot/solr/installer'
5
+
6
+ module Sunspot
7
+ module Solr
8
+ class Server #:nodoc:
9
+ # Raised if #stop is called but the server is not running
10
+ ServerError = Class.new(RuntimeError)
11
+ AlreadyRunningError = Class.new(ServerError)
12
+ NotRunningError = Class.new(ServerError)
13
+ JavaMissing = Class.new(ServerError)
14
+
15
+ # Name of the sunspot executable (shell script)
16
+ SOLR_START_JAR = File.expand_path(
17
+ File.join(File.dirname(__FILE__), '..', '..', '..', 'solr', 'start.jar')
18
+ )
19
+
20
+ LOG_LEVELS = Set['SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST']
21
+
22
+ attr_accessor :min_memory, :max_memory, :bind_address, :port, :log_file
23
+
24
+ attr_writer :pid_dir, :pid_file, :solr_data_dir, :solr_home, :solr_jar
25
+
26
+ def initialize(*args)
27
+ ensure_java_installed
28
+ super(*args)
29
+ end
30
+
31
+ #
32
+ # Bootstrap a new solr_home by creating all required
33
+ # directories.
34
+ #
35
+ # ==== Returns
36
+ #
37
+ # Boolean:: success
38
+ #
39
+ def bootstrap
40
+ unless @bootstrapped
41
+ install_solr_home
42
+ create_solr_directories
43
+ @bootstrapped = true
44
+ end
45
+ end
46
+
47
+ #
48
+ # Start the sunspot-solr server. Bootstrap solr_home first,
49
+ # if neccessary.
50
+ #
51
+ # ==== Returns
52
+ #
53
+ # Boolean:: success
54
+ #
55
+ def start
56
+ bootstrap
57
+
58
+ if File.exist?(pid_path)
59
+ existing_pid = IO.read(pid_path).to_i
60
+ begin
61
+ Process.kill(0, existing_pid)
62
+ raise(AlreadyRunningError, "Server is already running with PID #{existing_pid}")
63
+ rescue Errno::ESRCH
64
+ STDERR.puts("Removing stale PID file at #{pid_path}")
65
+ FileUtils.rm(pid_path)
66
+ end
67
+ end
68
+ fork do
69
+ pid = fork do
70
+ Process.setsid
71
+ STDIN.reopen('/dev/null')
72
+ STDOUT.reopen('/dev/null')
73
+ STDERR.reopen(STDOUT)
74
+ run
75
+ end
76
+ FileUtils.mkdir_p(pid_dir)
77
+ File.open(pid_path, 'w') do |file|
78
+ file << pid
79
+ end
80
+ end
81
+ end
82
+
83
+ #
84
+ # Run the sunspot-solr server in the foreground. Boostrap
85
+ # solr_home first, if neccessary.
86
+ #
87
+ # ==== Returns
88
+ #
89
+ # Boolean:: success
90
+ #
91
+ def run
92
+ bootstrap
93
+
94
+ command = ['java']
95
+ command << "-Xms#{min_memory}" if min_memory
96
+ command << "-Xmx#{max_memory}" if max_memory
97
+ command << "-Djetty.port=#{port}" if port
98
+ command << "-Djetty.host=#{bind_address}" if bind_address
99
+ command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir
100
+ command << "-Dsolr.solr.home=#{solr_home}" if solr_home
101
+ command << "-Djava.util.logging.config.file=#{logging_config_path}" if logging_config_path
102
+ command << "-Djava.awt.headless=true"
103
+ command << '-jar' << File.basename(solr_jar)
104
+ FileUtils.cd(File.dirname(solr_jar)) do
105
+ exec(*command)
106
+ end
107
+ end
108
+
109
+ #
110
+ # Stop the sunspot-solr server.
111
+ #
112
+ # ==== Returns
113
+ #
114
+ # Boolean:: success
115
+ #
116
+ def stop
117
+ if File.exist?(pid_path)
118
+ pid = IO.read(pid_path).to_i
119
+ begin
120
+ Process.kill('TERM', pid)
121
+ rescue Errno::ESRCH
122
+ raise NotRunningError, "Process with PID #{pid} is no longer running"
123
+ ensure
124
+ FileUtils.rm(pid_path)
125
+ end
126
+ else
127
+ raise NotRunningError, "No PID file at #{pid_path}"
128
+ end
129
+ end
130
+
131
+ def log_level=(level)
132
+ unless LOG_LEVELS.include?(level.to_s.upcase)
133
+ raise(ArgumentError, "#{level} is not a valid log level: Use one of #{LOG_LEVELS.to_a.join(',')}")
134
+ end
135
+ @log_level = level.to_s.upcase
136
+ end
137
+
138
+ def log_level
139
+ @log_level || 'WARNING'
140
+ end
141
+
142
+ def pid_path
143
+ File.join(pid_dir, pid_file)
144
+ end
145
+
146
+ def pid_file
147
+ @pid_file || 'sunspot-solr.pid'
148
+ end
149
+
150
+ def pid_dir
151
+ File.expand_path(@pid_dir || FileUtils.pwd)
152
+ end
153
+
154
+ def solr_data_dir
155
+ File.expand_path(@solr_data_dir || Dir.tmpdir)
156
+ end
157
+
158
+ def solr_home
159
+ File.expand_path(@solr_home || File.join(File.dirname(solr_jar), 'solr'))
160
+ end
161
+
162
+ def solr_jar
163
+ @solr_jar || SOLR_START_JAR
164
+ end
165
+
166
+ #
167
+ # Copy default solr configuration files from sunspot
168
+ # gem to the new solr_home/config directory
169
+ #
170
+ # ==== Returns
171
+ #
172
+ # Boolean:: success
173
+ #
174
+ def install_solr_home
175
+ unless File.exists?(solr_home)
176
+ Sunspot::Solr::Installer.execute(
177
+ solr_home,
178
+ :force => true,
179
+ :verbose => true
180
+ )
181
+ end
182
+ end
183
+
184
+ #
185
+ # Create new solr_home, config, log and pid directories
186
+ #
187
+ # ==== Returns
188
+ #
189
+ # Boolean:: success
190
+ #
191
+ def create_solr_directories
192
+ [solr_data_dir, pid_dir].each do |path|
193
+ FileUtils.mkdir_p(path) unless File.exists?(path)
194
+ end
195
+ end
196
+
197
+ private
198
+
199
+ def ensure_java_installed
200
+ unless defined?(@java_installed)
201
+ @java_installed = Sunspot::Solr::Java.installed?
202
+ unless @java_installed
203
+ raise JavaMissing.new("You need a Java Runtime Environment to run the Solr server")
204
+ end
205
+ end
206
+ @java_installed
207
+ end
208
+
209
+ def logging_config_path
210
+ return @logging_config_path if defined?(@logging_config_path)
211
+ @logging_config_path =
212
+ if log_file
213
+ logging_config = Tempfile.new('logging.properties')
214
+ logging_config.puts("handlers = java.util.logging.FileHandler")
215
+ logging_config.puts("java.util.logging.FileHandler.level = #{log_level.to_s.upcase}")
216
+ logging_config.puts("java.util.logging.FileHandler.pattern = #{log_file}")
217
+ logging_config.puts("java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter")
218
+ logging_config.flush
219
+ logging_config.close
220
+ logging_config.path
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,44 @@
1
+ namespace :sunspot do
2
+ namespace :solr do
3
+ desc 'Start the Solr instance'
4
+ task start: :environment do
5
+ case RUBY_PLATFORM
6
+ when /w(in)?32$/, /java$/
7
+ abort("This command is not supported on #{RUBY_PLATFORM}. " +
8
+ "Use rake sunspot:solr:run to run Solr in the foreground.")
9
+ end
10
+ server.start
11
+ puts 'Successfully started Solr ...'
12
+ end
13
+
14
+ desc 'Run the Solr instance in the foreground'
15
+ task run: :environment do
16
+ server.run
17
+ end
18
+
19
+ desc 'Stop the Solr instance'
20
+ task stop: :environment do
21
+ server.stop
22
+ puts 'Successfully stopped Solr ...'
23
+ end
24
+
25
+ desc 'Restart the Solr instance'
26
+ task restart: :environment do
27
+ Rake::Task['sunspot:solr:stop'].invoke if File.exist?(server.pid_path)
28
+ Rake::Task['sunspot:solr:start'].invoke
29
+ end
30
+
31
+ # for backwards compatibility
32
+ task :reindex, [:batch_size, :models, :silence] => :"sunspot:reindex"
33
+
34
+ def server
35
+
36
+
37
+ if defined?(Sunspot::Rails::Server)
38
+ Sunspot::Rails::Server.new
39
+ else
40
+ Sunspot::Solr::Server.new
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module Sunspot
2
+ module Solr
3
+ VERSION = "2.2.0.rc1"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'sunspot/solr/server'
2
+
3
+ if defined?(Rails::Railtie)
4
+ require 'sunspot/solr/railtie'
5
+ end
@@ -0,0 +1 @@
1
+ require 'sunspot_solr-jts'
data/solr/README.txt ADDED
@@ -0,0 +1,42 @@
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
+ Solr example configuration
17
+ --------------------------
18
+
19
+ To run this example configuration, use
20
+
21
+ java -jar start.jar
22
+
23
+ in this directory, and when Solr is started connect to
24
+
25
+ http://localhost:8983/solr/admin/
26
+
27
+ To add documents to the index, use the post.sh script in the exampledocs
28
+ subdirectory (while Solr is running), for example:
29
+
30
+ cd exampledocs
31
+ ./post.sh *.xml
32
+
33
+ See also README.txt in the solr subdirectory, and check
34
+ http://wiki.apache.org/solr/SolrResources for a list of tutorials and
35
+ introductory articles.
36
+
37
+ NOTE: This Solr example server references SolrCell jars outside of the server
38
+ directory with <lib> statements in the solrconfig.xml. If you make a copy of
39
+ this example server and wish to use the ExtractingRequestHandler (SolrCell),
40
+ you will need to copy the required jars into solr/lib or update the paths to
41
+ the jars in your solrconfig.xml.
42
+
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
3
+ <Configure class="org.eclipse.jetty.webapp.WebAppContext">
4
+ <Set name="contextPath"><SystemProperty name="hostContext" default="/solr"/></Set>
5
+ <Set name="war"><SystemProperty name="jetty.home"/>/webapps/solr.war</Set>
6
+ <Set name="defaultsDescriptor"><SystemProperty name="jetty.home"/>/etc/webdefault.xml</Set>
7
+ </Configure>