sunspot_rails 2.0.0.pre.120924 → 2.0.0.pre.120925
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/.gitignore +6 -10
- data/{sunspot_rails/.rspec → .rspec} +0 -0
- data/{sunspot_rails/History.txt → History.txt} +0 -0
- data/{sunspot/LICENSE → LICENSE} +0 -0
- data/{sunspot_rails/MIT-LICENSE → MIT-LICENSE} +0 -0
- data/{sunspot_rails/README.rdoc → README.rdoc} +0 -0
- data/Rakefile +12 -32
- data/{sunspot_rails/TODO → TODO} +0 -0
- data/{sunspot_rails/dev_tasks → dev_tasks}/rdoc.rake +0 -0
- data/{sunspot_rails/dev_tasks → dev_tasks}/release.rake +0 -0
- data/{sunspot_rails/dev_tasks → dev_tasks}/spec.rake +0 -0
- data/{sunspot/tasks → dev_tasks}/todo.rake +0 -0
- data/{sunspot_rails/gemfiles → gemfiles}/rails-2.3.14 +0 -0
- data/{sunspot_rails/gemfiles → gemfiles}/rails-3.0.15 +0 -0
- data/{sunspot_rails/gemfiles → gemfiles}/rails-3.1.6 +0 -0
- data/{sunspot_rails/gemfiles → gemfiles}/rails-3.2.6 +0 -0
- data/{sunspot_rails/generators → generators}/sunspot/sunspot_generator.rb +0 -0
- data/{sunspot_rails/generators → generators}/sunspot/templates/sunspot.yml +0 -0
- data/{sunspot_rails/install.rb → install.rb} +0 -0
- data/{sunspot_rails/lib → lib}/generators/sunspot_rails.rb +0 -0
- data/{sunspot_rails/lib → lib}/generators/sunspot_rails/install/install_generator.rb +0 -0
- data/{sunspot_rails/lib → lib}/generators/sunspot_rails/install/templates/config/sunspot.yml +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/adapters.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/configuration.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/init.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/log_subscriber.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/railtie.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/railties/controller_runtime.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/request_lifecycle.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/searchable.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/server.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/solr_instrumentation.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/solr_logging.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/spec_helper.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/stub_session_proxy.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot/rails/tasks.rb +0 -0
- data/{sunspot_rails/lib → lib}/sunspot_rails.rb +0 -0
- data/{sunspot_rails/spec → spec}/configuration_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/model_lifecycle_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/model_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/controllers/application_controller.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/controllers/posts_controller.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/author.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/blog.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/location.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/photo_post.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/post.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/post_with_auto.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/app/models/post_with_default_scope.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/config/boot.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/config/preinitializer.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/config/routes.rb +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/config/sunspot.yml +0 -0
- data/{sunspot_rails/spec → spec}/rails_template/db/schema.rb +0 -0
- data/{sunspot_rails/spec → spec}/request_lifecycle_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/schema.rb +0 -0
- data/{sunspot_rails/spec → spec}/searchable_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/server_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/session_spec.rb +0 -0
- data/{sunspot_rails/spec → spec}/shared_examples/indexed_after_save.rb +0 -0
- data/{sunspot_rails/spec → spec}/shared_examples/not_indexed_after_save.rb +0 -0
- data/{sunspot_rails/spec → spec}/spec_helper.rb +0 -0
- data/{sunspot_rails/spec → spec}/stub_session_proxy_spec.rb +0 -0
- data/{sunspot_rails/sunspot_rails.gemspec → sunspot_rails.gemspec} +0 -0
- metadata +102 -305
- data/.travis.yml +0 -35
- data/README.md +0 -863
- data/ci/travis.sh +0 -67
- data/sunspot/.gitignore +0 -13
- data/sunspot/Gemfile +0 -5
- data/sunspot/History.txt +0 -258
- data/sunspot/Rakefile +0 -13
- data/sunspot/TODO +0 -13
- data/sunspot/lib/light_config.rb +0 -40
- data/sunspot/lib/sunspot.rb +0 -579
- data/sunspot/lib/sunspot/adapters.rb +0 -349
- data/sunspot/lib/sunspot/batcher.rb +0 -62
- data/sunspot/lib/sunspot/class_set.rb +0 -23
- data/sunspot/lib/sunspot/composite_setup.rb +0 -202
- data/sunspot/lib/sunspot/configuration.rb +0 -53
- data/sunspot/lib/sunspot/data_extractor.rb +0 -50
- data/sunspot/lib/sunspot/dsl.rb +0 -5
- data/sunspot/lib/sunspot/dsl/adjustable.rb +0 -47
- data/sunspot/lib/sunspot/dsl/field_group.rb +0 -57
- data/sunspot/lib/sunspot/dsl/field_query.rb +0 -345
- data/sunspot/lib/sunspot/dsl/fields.rb +0 -103
- data/sunspot/lib/sunspot/dsl/fulltext.rb +0 -243
- data/sunspot/lib/sunspot/dsl/function.rb +0 -27
- data/sunspot/lib/sunspot/dsl/functional.rb +0 -44
- data/sunspot/lib/sunspot/dsl/more_like_this_query.rb +0 -56
- data/sunspot/lib/sunspot/dsl/paginatable.rb +0 -32
- data/sunspot/lib/sunspot/dsl/query_facet.rb +0 -36
- data/sunspot/lib/sunspot/dsl/restriction.rb +0 -25
- data/sunspot/lib/sunspot/dsl/restriction_with_near.rb +0 -160
- data/sunspot/lib/sunspot/dsl/scope.rb +0 -214
- data/sunspot/lib/sunspot/dsl/search.rb +0 -30
- data/sunspot/lib/sunspot/dsl/standard_query.rb +0 -122
- data/sunspot/lib/sunspot/field.rb +0 -193
- data/sunspot/lib/sunspot/field_factory.rb +0 -129
- data/sunspot/lib/sunspot/indexer.rb +0 -136
- data/sunspot/lib/sunspot/query.rb +0 -11
- data/sunspot/lib/sunspot/query/abstract_field_facet.rb +0 -55
- data/sunspot/lib/sunspot/query/bbox.rb +0 -15
- data/sunspot/lib/sunspot/query/boost_query.rb +0 -24
- data/sunspot/lib/sunspot/query/common_query.rb +0 -96
- data/sunspot/lib/sunspot/query/composite_fulltext.rb +0 -36
- data/sunspot/lib/sunspot/query/connective.rb +0 -206
- data/sunspot/lib/sunspot/query/date_field_facet.rb +0 -14
- data/sunspot/lib/sunspot/query/dismax.rb +0 -132
- data/sunspot/lib/sunspot/query/field_facet.rb +0 -41
- data/sunspot/lib/sunspot/query/field_group.rb +0 -37
- data/sunspot/lib/sunspot/query/filter.rb +0 -38
- data/sunspot/lib/sunspot/query/function_query.rb +0 -52
- data/sunspot/lib/sunspot/query/geo.rb +0 -53
- data/sunspot/lib/sunspot/query/geofilt.rb +0 -16
- data/sunspot/lib/sunspot/query/highlighting.rb +0 -62
- data/sunspot/lib/sunspot/query/more_like_this.rb +0 -61
- data/sunspot/lib/sunspot/query/more_like_this_query.rb +0 -12
- data/sunspot/lib/sunspot/query/pagination.rb +0 -42
- data/sunspot/lib/sunspot/query/query_facet.rb +0 -53
- data/sunspot/lib/sunspot/query/range_facet.rb +0 -15
- data/sunspot/lib/sunspot/query/restriction.rb +0 -308
- data/sunspot/lib/sunspot/query/scope.rb +0 -9
- data/sunspot/lib/sunspot/query/sort.rb +0 -109
- data/sunspot/lib/sunspot/query/sort_composite.rb +0 -34
- data/sunspot/lib/sunspot/query/standard_query.rb +0 -16
- data/sunspot/lib/sunspot/query/text_field_boost.rb +0 -17
- data/sunspot/lib/sunspot/schema.rb +0 -151
- data/sunspot/lib/sunspot/search.rb +0 -9
- data/sunspot/lib/sunspot/search/abstract_search.rb +0 -286
- data/sunspot/lib/sunspot/search/date_facet.rb +0 -35
- data/sunspot/lib/sunspot/search/facet_row.rb +0 -27
- data/sunspot/lib/sunspot/search/field_facet.rb +0 -88
- data/sunspot/lib/sunspot/search/field_group.rb +0 -70
- data/sunspot/lib/sunspot/search/group.rb +0 -54
- data/sunspot/lib/sunspot/search/highlight.rb +0 -38
- data/sunspot/lib/sunspot/search/hit.rb +0 -150
- data/sunspot/lib/sunspot/search/hit_enumerable.rb +0 -68
- data/sunspot/lib/sunspot/search/more_like_this_search.rb +0 -31
- data/sunspot/lib/sunspot/search/paginated_collection.rb +0 -57
- data/sunspot/lib/sunspot/search/query_facet.rb +0 -67
- data/sunspot/lib/sunspot/search/range_facet.rb +0 -37
- data/sunspot/lib/sunspot/search/standard_search.rb +0 -21
- data/sunspot/lib/sunspot/session.rb +0 -262
- data/sunspot/lib/sunspot/session_proxy.rb +0 -95
- data/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb +0 -29
- data/sunspot/lib/sunspot/session_proxy/class_sharding_session_proxy.rb +0 -66
- data/sunspot/lib/sunspot/session_proxy/id_sharding_session_proxy.rb +0 -89
- data/sunspot/lib/sunspot/session_proxy/master_slave_session_proxy.rb +0 -43
- data/sunspot/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb +0 -67
- data/sunspot/lib/sunspot/session_proxy/sharding_session_proxy.rb +0 -222
- data/sunspot/lib/sunspot/session_proxy/silent_fail_session_proxy.rb +0 -42
- data/sunspot/lib/sunspot/session_proxy/thread_local_session_proxy.rb +0 -37
- data/sunspot/lib/sunspot/setup.rb +0 -350
- data/sunspot/lib/sunspot/text_field_setup.rb +0 -29
- data/sunspot/lib/sunspot/type.rb +0 -393
- data/sunspot/lib/sunspot/util.rb +0 -252
- data/sunspot/lib/sunspot/version.rb +0 -3
- data/sunspot/script/console +0 -10
- data/sunspot/spec/api/adapters_spec.rb +0 -68
- data/sunspot/spec/api/batcher_spec.rb +0 -112
- data/sunspot/spec/api/binding_spec.rb +0 -50
- data/sunspot/spec/api/class_set_spec.rb +0 -24
- data/sunspot/spec/api/hit_enumerable_spec.rb +0 -47
- data/sunspot/spec/api/indexer/attributes_spec.rb +0 -149
- data/sunspot/spec/api/indexer/batch_spec.rb +0 -72
- data/sunspot/spec/api/indexer/dynamic_fields_spec.rb +0 -42
- data/sunspot/spec/api/indexer/fixed_fields_spec.rb +0 -57
- data/sunspot/spec/api/indexer/fulltext_spec.rb +0 -43
- data/sunspot/spec/api/indexer/removal_spec.rb +0 -53
- data/sunspot/spec/api/indexer/spec_helper.rb +0 -1
- data/sunspot/spec/api/indexer_spec.rb +0 -14
- data/sunspot/spec/api/query/advanced_manipulation_examples.rb +0 -35
- data/sunspot/spec/api/query/connectives_examples.rb +0 -201
- data/sunspot/spec/api/query/dsl_spec.rb +0 -18
- data/sunspot/spec/api/query/dynamic_fields_examples.rb +0 -165
- data/sunspot/spec/api/query/faceting_examples.rb +0 -497
- data/sunspot/spec/api/query/fulltext_examples.rb +0 -313
- data/sunspot/spec/api/query/function_spec.rb +0 -79
- data/sunspot/spec/api/query/geo_examples.rb +0 -68
- data/sunspot/spec/api/query/group_spec.rb +0 -32
- data/sunspot/spec/api/query/highlighting_examples.rb +0 -245
- data/sunspot/spec/api/query/more_like_this_spec.rb +0 -140
- data/sunspot/spec/api/query/ordering_pagination_examples.rb +0 -116
- data/sunspot/spec/api/query/scope_examples.rb +0 -275
- data/sunspot/spec/api/query/spatial_examples.rb +0 -27
- data/sunspot/spec/api/query/spec_helper.rb +0 -1
- data/sunspot/spec/api/query/standard_spec.rb +0 -29
- data/sunspot/spec/api/query/text_field_scoping_examples.rb +0 -30
- data/sunspot/spec/api/query/types_spec.rb +0 -20
- data/sunspot/spec/api/search/dynamic_fields_spec.rb +0 -33
- data/sunspot/spec/api/search/faceting_spec.rb +0 -360
- data/sunspot/spec/api/search/highlighting_spec.rb +0 -69
- data/sunspot/spec/api/search/hits_spec.rb +0 -147
- data/sunspot/spec/api/search/paginated_collection_spec.rb +0 -36
- data/sunspot/spec/api/search/results_spec.rb +0 -72
- data/sunspot/spec/api/search/search_spec.rb +0 -23
- data/sunspot/spec/api/search/spec_helper.rb +0 -1
- data/sunspot/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +0 -85
- data/sunspot/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +0 -30
- data/sunspot/spec/api/session_proxy/master_slave_session_proxy_spec.rb +0 -41
- data/sunspot/spec/api/session_proxy/retry_5xx_session_proxy_spec.rb +0 -78
- data/sunspot/spec/api/session_proxy/sharding_session_proxy_spec.rb +0 -77
- data/sunspot/spec/api/session_proxy/silent_fail_session_proxy_spec.rb +0 -24
- data/sunspot/spec/api/session_proxy/spec_helper.rb +0 -9
- data/sunspot/spec/api/session_proxy/thread_local_session_proxy_spec.rb +0 -39
- data/sunspot/spec/api/session_spec.rb +0 -232
- data/sunspot/spec/api/spec_helper.rb +0 -3
- data/sunspot/spec/api/sunspot_spec.rb +0 -29
- data/sunspot/spec/ext.rb +0 -11
- data/sunspot/spec/helpers/indexer_helper.rb +0 -17
- data/sunspot/spec/helpers/integration_helper.rb +0 -8
- data/sunspot/spec/helpers/mock_session_helper.rb +0 -13
- data/sunspot/spec/helpers/query_helper.rb +0 -26
- data/sunspot/spec/helpers/search_helper.rb +0 -68
- data/sunspot/spec/integration/dynamic_fields_spec.rb +0 -57
- data/sunspot/spec/integration/faceting_spec.rb +0 -330
- data/sunspot/spec/integration/field_grouping_spec.rb +0 -100
- data/sunspot/spec/integration/geospatial_spec.rb +0 -96
- data/sunspot/spec/integration/highlighting_spec.rb +0 -44
- data/sunspot/spec/integration/indexing_spec.rb +0 -55
- data/sunspot/spec/integration/keyword_search_spec.rb +0 -317
- data/sunspot/spec/integration/local_search_spec.rb +0 -64
- data/sunspot/spec/integration/more_like_this_spec.rb +0 -43
- data/sunspot/spec/integration/scoped_search_spec.rb +0 -386
- data/sunspot/spec/integration/stored_fields_spec.rb +0 -12
- data/sunspot/spec/integration/test_pagination.rb +0 -43
- data/sunspot/spec/integration/unicode_spec.rb +0 -15
- data/sunspot/spec/mocks/adapters.rb +0 -33
- data/sunspot/spec/mocks/blog.rb +0 -3
- data/sunspot/spec/mocks/comment.rb +0 -21
- data/sunspot/spec/mocks/connection.rb +0 -126
- data/sunspot/spec/mocks/mock_adapter.rb +0 -30
- data/sunspot/spec/mocks/mock_class_sharding_session_proxy.rb +0 -24
- data/sunspot/spec/mocks/mock_record.rb +0 -52
- data/sunspot/spec/mocks/mock_sharding_session_proxy.rb +0 -15
- data/sunspot/spec/mocks/photo.rb +0 -11
- data/sunspot/spec/mocks/post.rb +0 -86
- data/sunspot/spec/mocks/super_class.rb +0 -2
- data/sunspot/spec/mocks/user.rb +0 -13
- data/sunspot/spec/spec_helper.rb +0 -40
- data/sunspot/sunspot.gemspec +0 -37
- data/sunspot/tasks/rdoc.rake +0 -27
- data/sunspot/tasks/schema.rake +0 -19
- data/sunspot_rails/.gitignore +0 -7
- data/sunspot_rails/LICENSE +0 -18
- data/sunspot_rails/Rakefile +0 -17
- data/sunspot_rails/dev_tasks/todo.rake +0 -4
- data/sunspot_solr/Gemfile +0 -3
- data/sunspot_solr/README.rdoc +0 -24
- data/sunspot_solr/bin/sunspot-installer +0 -20
- data/sunspot_solr/bin/sunspot-solr +0 -80
- data/sunspot_solr/lib/sunspot/solr/installer.rb +0 -25
- data/sunspot_solr/lib/sunspot/solr/installer/config_installer.rb +0 -46
- data/sunspot_solr/lib/sunspot/solr/installer/task_helper.rb +0 -13
- data/sunspot_solr/lib/sunspot/solr/java.rb +0 -10
- data/sunspot_solr/lib/sunspot/solr/railtie.rb +0 -15
- data/sunspot_solr/lib/sunspot/solr/server.rb +0 -223
- data/sunspot_solr/lib/sunspot/solr/tasks.rb +0 -49
- data/sunspot_solr/lib/sunspot_solr.rb +0 -5
- data/sunspot_solr/solr/README.txt +0 -42
- data/sunspot_solr/solr/etc/jetty.xml +0 -219
- data/sunspot_solr/solr/etc/webdefault.xml +0 -379
- data/sunspot_solr/solr/lib/jetty-6.1.26-patched-JETTY-1340.jar +0 -0
- data/sunspot_solr/solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar +0 -0
- data/sunspot_solr/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/sunspot_solr/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/sunspot_solr/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/sunspot_solr/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/sunspot_solr/solr/lib/servlet-api-2.5-20081211.jar +0 -0
- data/sunspot_solr/solr/solr/.gitignore +0 -1
- data/sunspot_solr/solr/solr/README.txt +0 -54
- data/sunspot_solr/solr/solr/conf/admin-extra.html +0 -31
- data/sunspot_solr/solr/solr/conf/elevate.xml +0 -36
- data/sunspot_solr/solr/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
- data/sunspot_solr/solr/solr/conf/protwords.txt +0 -21
- data/sunspot_solr/solr/solr/conf/schema.xml +0 -250
- data/sunspot_solr/solr/solr/conf/scripts.conf +0 -24
- data/sunspot_solr/solr/solr/conf/solrconfig.xml +0 -934
- data/sunspot_solr/solr/solr/conf/spellings.txt +0 -2
- data/sunspot_solr/solr/solr/conf/stopwords.txt +0 -58
- data/sunspot_solr/solr/solr/conf/synonyms.txt +0 -31
- data/sunspot_solr/solr/solr/conf/xslt/example.xsl +0 -132
- data/sunspot_solr/solr/solr/conf/xslt/example_atom.xsl +0 -67
- data/sunspot_solr/solr/solr/conf/xslt/example_rss.xsl +0 -66
- data/sunspot_solr/solr/solr/conf/xslt/luke.xsl +0 -337
- data/sunspot_solr/solr/start.jar +0 -0
- data/sunspot_solr/solr/webapps/solr.war +0 -0
- data/sunspot_solr/spec/server_spec.rb +0 -98
- data/sunspot_solr/spec/spec_helper.rb +0 -18
- data/sunspot_solr/sunspot_solr.gemspec +0 -37
- data/tools/gem_tasks.rb +0 -69
@@ -1,223 +0,0 @@
|
|
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, :solr_data_dir, :solr_home, :log_file
|
23
|
-
attr_writer :pid_dir, :pid_file, :log_level, :solr_data_dir, :solr_home, :solr_jar
|
24
|
-
|
25
|
-
def initialize(*args)
|
26
|
-
ensure_java_installed
|
27
|
-
super(*args)
|
28
|
-
end
|
29
|
-
|
30
|
-
#
|
31
|
-
# Bootstrap a new solr_home by creating all required
|
32
|
-
# directories.
|
33
|
-
#
|
34
|
-
# ==== Returns
|
35
|
-
#
|
36
|
-
# Boolean:: success
|
37
|
-
#
|
38
|
-
def bootstrap
|
39
|
-
unless @bootstrapped
|
40
|
-
install_solr_home
|
41
|
-
create_solr_directories
|
42
|
-
@bootstrapped = true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
#
|
47
|
-
# Start the sunspot-solr server. Bootstrap solr_home first,
|
48
|
-
# if neccessary.
|
49
|
-
#
|
50
|
-
# ==== Returns
|
51
|
-
#
|
52
|
-
# Boolean:: success
|
53
|
-
#
|
54
|
-
def start
|
55
|
-
bootstrap
|
56
|
-
|
57
|
-
if File.exist?(pid_path)
|
58
|
-
existing_pid = IO.read(pid_path).to_i
|
59
|
-
begin
|
60
|
-
Process.kill(0, existing_pid)
|
61
|
-
raise(AlreadyRunningError, "Server is already running with PID #{existing_pid}")
|
62
|
-
rescue Errno::ESRCH
|
63
|
-
STDERR.puts("Removing stale PID file at #{pid_path}")
|
64
|
-
FileUtils.rm(pid_path)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
fork do
|
68
|
-
pid = fork do
|
69
|
-
Process.setsid
|
70
|
-
STDIN.reopen('/dev/null')
|
71
|
-
STDOUT.reopen('/dev/null', 'a')
|
72
|
-
STDERR.reopen(STDOUT)
|
73
|
-
run
|
74
|
-
end
|
75
|
-
FileUtils.mkdir_p(pid_dir)
|
76
|
-
File.open(pid_path, 'w') do |file|
|
77
|
-
file << pid
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
#
|
83
|
-
# Run the sunspot-solr server in the foreground. Boostrap
|
84
|
-
# solr_home first, if neccessary.
|
85
|
-
#
|
86
|
-
# ==== Returns
|
87
|
-
#
|
88
|
-
# Boolean:: success
|
89
|
-
#
|
90
|
-
def run
|
91
|
-
bootstrap
|
92
|
-
|
93
|
-
command = ['java']
|
94
|
-
command << "-Xms#{min_memory}" if min_memory
|
95
|
-
command << "-Xmx#{max_memory}" if max_memory
|
96
|
-
command << "-Djetty.port=#{port}" if port
|
97
|
-
command << "-Djetty.host=#{bind_address}" if bind_address
|
98
|
-
command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir
|
99
|
-
command << "-Dsolr.solr.home=#{solr_home}" if solr_home
|
100
|
-
command << "-Djava.util.logging.config.file=#{logging_config_path}" if logging_config_path
|
101
|
-
command << '-jar' << File.basename(solr_jar)
|
102
|
-
FileUtils.cd(File.dirname(solr_jar)) do
|
103
|
-
exec(*command)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
#
|
108
|
-
# Stop the sunspot-solr server.
|
109
|
-
#
|
110
|
-
# ==== Returns
|
111
|
-
#
|
112
|
-
# Boolean:: success
|
113
|
-
#
|
114
|
-
def stop
|
115
|
-
if File.exist?(pid_path)
|
116
|
-
pid = IO.read(pid_path).to_i
|
117
|
-
begin
|
118
|
-
Process.kill('TERM', pid)
|
119
|
-
rescue Errno::ESRCH
|
120
|
-
raise NotRunningError, "Process with PID #{pid} is no longer running"
|
121
|
-
ensure
|
122
|
-
FileUtils.rm(pid_path)
|
123
|
-
end
|
124
|
-
else
|
125
|
-
raise NotRunningError, "No PID file at #{pid_path}"
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def log_level=(level)
|
130
|
-
unless LOG_LEVELS.include?(level.to_s.upcase)
|
131
|
-
raise(ArgumentError, "#{level} is not a valid log level: Use one of #{LOG_LEVELS.to_a.join(',')}")
|
132
|
-
end
|
133
|
-
@log_level = level.to_s.upcase
|
134
|
-
end
|
135
|
-
|
136
|
-
def log_level
|
137
|
-
@log_level || 'WARNING'
|
138
|
-
end
|
139
|
-
|
140
|
-
def pid_path
|
141
|
-
File.join(pid_dir, pid_file)
|
142
|
-
end
|
143
|
-
|
144
|
-
def pid_file
|
145
|
-
@pid_file || 'sunspot-solr.pid'
|
146
|
-
end
|
147
|
-
|
148
|
-
def pid_dir
|
149
|
-
File.expand_path(@pid_dir || FileUtils.pwd)
|
150
|
-
end
|
151
|
-
|
152
|
-
def solr_data_dir
|
153
|
-
File.expand_path(@solr_data_dir || Dir.tmpdir)
|
154
|
-
end
|
155
|
-
|
156
|
-
def solr_home
|
157
|
-
File.expand_path(@solr_home || File.join(File.dirname(solr_jar), 'solr'))
|
158
|
-
end
|
159
|
-
|
160
|
-
def solr_jar
|
161
|
-
@solr_jar || SOLR_START_JAR
|
162
|
-
end
|
163
|
-
|
164
|
-
#
|
165
|
-
# Copy default solr configuration files from sunspot
|
166
|
-
# gem to the new solr_home/config directory
|
167
|
-
#
|
168
|
-
# ==== Returns
|
169
|
-
#
|
170
|
-
# Boolean:: success
|
171
|
-
#
|
172
|
-
def install_solr_home
|
173
|
-
unless File.exists?(solr_home)
|
174
|
-
Sunspot::Solr::Installer.execute(
|
175
|
-
solr_home,
|
176
|
-
:force => true,
|
177
|
-
:verbose => true
|
178
|
-
)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
#
|
183
|
-
# Create new solr_home, config, log and pid directories
|
184
|
-
#
|
185
|
-
# ==== Returns
|
186
|
-
#
|
187
|
-
# Boolean:: success
|
188
|
-
#
|
189
|
-
def create_solr_directories
|
190
|
-
[solr_data_dir, pid_dir].each do |path|
|
191
|
-
FileUtils.mkdir_p(path) unless File.exists?(path)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
private
|
196
|
-
|
197
|
-
def ensure_java_installed
|
198
|
-
unless defined?(@java_installed)
|
199
|
-
@java_installed = Sunspot::Solr::Java.installed?
|
200
|
-
unless @java_installed
|
201
|
-
raise JavaMissing.new("You need a Java Runtime Environment to run the Solr server")
|
202
|
-
end
|
203
|
-
end
|
204
|
-
@java_installed
|
205
|
-
end
|
206
|
-
|
207
|
-
def logging_config_path
|
208
|
-
return @logging_config_path if defined?(@logging_config_path)
|
209
|
-
@logging_config_path =
|
210
|
-
if log_file
|
211
|
-
logging_config = Tempfile.new('logging.properties')
|
212
|
-
logging_config.puts("handlers = java.util.logging.FileHandler")
|
213
|
-
logging_config.puts("java.util.logging.FileHandler.level = #{log_level.to_s.upcase}")
|
214
|
-
logging_config.puts("java.util.logging.FileHandler.pattern = #{log_file}")
|
215
|
-
logging_config.puts("java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter")
|
216
|
-
logging_config.flush
|
217
|
-
logging_config.close
|
218
|
-
logging_config.path
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
@@ -1,49 +0,0 @@
|
|
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
|
-
|
11
|
-
if defined?(Sunspot::Rails::Server)
|
12
|
-
Sunspot::Rails::Server.new.start
|
13
|
-
else
|
14
|
-
Sunspot::Solr::Server.new.start
|
15
|
-
end
|
16
|
-
|
17
|
-
puts "Successfully started Solr ..."
|
18
|
-
end
|
19
|
-
|
20
|
-
desc 'Run the Solr instance in the foreground'
|
21
|
-
task :run => :environment do
|
22
|
-
if defined?(Sunspot::Rails::Server)
|
23
|
-
Sunspot::Rails::Server.new.run
|
24
|
-
else
|
25
|
-
Sunspot::Solr::Server.new.run
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
desc 'Stop the Solr instance'
|
30
|
-
task :stop => :environment do
|
31
|
-
case RUBY_PLATFORM
|
32
|
-
when /w(in)?32$/, /java$/
|
33
|
-
abort("This command is not supported on #{RUBY_PLATFORM}. " +
|
34
|
-
"Use rake sunspot:solr:run to run Solr in the foreground.")
|
35
|
-
end
|
36
|
-
|
37
|
-
if defined?(Sunspot::Rails::Server)
|
38
|
-
Sunspot::Rails::Server.new.stop
|
39
|
-
else
|
40
|
-
Sunspot::Solr::Server.new.stop
|
41
|
-
end
|
42
|
-
|
43
|
-
puts "Successfully stopped Solr ..."
|
44
|
-
end
|
45
|
-
|
46
|
-
# for backwards compatibility
|
47
|
-
task :reindex => :"sunspot:reindex"
|
48
|
-
end
|
49
|
-
end
|
@@ -1,42 +0,0 @@
|
|
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
|
-
|
@@ -1,219 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
|
3
|
-
|
4
|
-
<!-- =============================================================== -->
|
5
|
-
<!-- Configure the Jetty Server -->
|
6
|
-
<!-- -->
|
7
|
-
<!-- Documentation of this file format can be found at: -->
|
8
|
-
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
|
9
|
-
<!-- -->
|
10
|
-
<!-- =============================================================== -->
|
11
|
-
|
12
|
-
|
13
|
-
<Configure id="Server" class="org.mortbay.jetty.Server">
|
14
|
-
|
15
|
-
<!-- Increase the maximum POST size to 1 MB to be able to handle large shard requests -->
|
16
|
-
<Call class="java.lang.System" name="setProperty">
|
17
|
-
<Arg>org.mortbay.jetty.Request.maxFormContentSize</Arg>
|
18
|
-
<Arg>1000000</Arg>
|
19
|
-
</Call>
|
20
|
-
|
21
|
-
<!-- =========================================================== -->
|
22
|
-
<!-- Server Thread Pool -->
|
23
|
-
<!-- =========================================================== -->
|
24
|
-
<Set name="ThreadPool">
|
25
|
-
<!-- Default bounded blocking threadpool
|
26
|
-
-->
|
27
|
-
<New class="org.mortbay.thread.BoundedThreadPool">
|
28
|
-
<Set name="minThreads">10</Set>
|
29
|
-
<Set name="lowThreads">50</Set>
|
30
|
-
<Set name="maxThreads">10000</Set>
|
31
|
-
</New>
|
32
|
-
|
33
|
-
<!-- Optional Java 5 bounded threadpool with job queue
|
34
|
-
<New class="org.mortbay.thread.concurrent.ThreadPool">
|
35
|
-
<Arg type="int">0</Arg>
|
36
|
-
<Set name="corePoolSize">10</Set>
|
37
|
-
<Set name="maximumPoolSize">250</Set>
|
38
|
-
</New>
|
39
|
-
-->
|
40
|
-
</Set>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
<!-- =========================================================== -->
|
45
|
-
<!-- Set connectors -->
|
46
|
-
<!-- =========================================================== -->
|
47
|
-
<!-- One of each type! -->
|
48
|
-
<!-- =========================================================== -->
|
49
|
-
|
50
|
-
<!-- Use this connector for many frequently idle connections
|
51
|
-
and for threadless continuations.
|
52
|
-
<Call name="addConnector">
|
53
|
-
<Arg>
|
54
|
-
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
|
55
|
-
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
|
56
|
-
<Set name="maxIdleTime">30000</Set>
|
57
|
-
<Set name="Acceptors">2</Set>
|
58
|
-
<Set name="confidentialPort">8443</Set>
|
59
|
-
</New>
|
60
|
-
</Arg>
|
61
|
-
</Call>
|
62
|
-
-->
|
63
|
-
|
64
|
-
<!-- Use this connector if NIO is not available. -->
|
65
|
-
<!-- This connector is currently being used for Solr because the
|
66
|
-
nio.SelectChannelConnector showed poor performance under WindowsXP
|
67
|
-
from a single client with non-persistent connections (35s vs ~3min)
|
68
|
-
to complete 10,000 requests)
|
69
|
-
-->
|
70
|
-
<Call name="addConnector">
|
71
|
-
<Arg>
|
72
|
-
<New class="org.mortbay.jetty.bio.SocketConnector">
|
73
|
-
<Set name="host"><SystemProperty name="jetty.host" default="0.0.0.0"/></Set>
|
74
|
-
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
|
75
|
-
<Set name="maxIdleTime">50000</Set>
|
76
|
-
<Set name="lowResourceMaxIdleTime">1500</Set>
|
77
|
-
<!-- Increase header buffer size from default of 4KB to 64KB to
|
78
|
-
prevent Solr from reaching this limit during large queries
|
79
|
-
-->
|
80
|
-
<Set name="headerBufferSize">65536</Set>
|
81
|
-
</New>
|
82
|
-
</Arg>
|
83
|
-
</Call>
|
84
|
-
|
85
|
-
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
86
|
-
<!-- To add a HTTPS SSL listener -->
|
87
|
-
<!-- see jetty-ssl.xml to add an ssl connector. use -->
|
88
|
-
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
|
89
|
-
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
90
|
-
|
91
|
-
<!-- =========================================================== -->
|
92
|
-
<!-- Set up global session ID manager -->
|
93
|
-
<!-- =========================================================== -->
|
94
|
-
<!--
|
95
|
-
<Set name="sessionIdManager">
|
96
|
-
<New class="org.mortbay.jetty.servlet.HashSessionIdManager">
|
97
|
-
<Set name="workerName">node1</Set>
|
98
|
-
</New>
|
99
|
-
</Set>
|
100
|
-
-->
|
101
|
-
|
102
|
-
<!-- =========================================================== -->
|
103
|
-
<!-- Set handler Collection Structure -->
|
104
|
-
<!-- =========================================================== -->
|
105
|
-
<Set name="handler">
|
106
|
-
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
|
107
|
-
<Set name="handlers">
|
108
|
-
<Array type="org.mortbay.jetty.Handler">
|
109
|
-
<Item>
|
110
|
-
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
|
111
|
-
</Item>
|
112
|
-
<Item>
|
113
|
-
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
|
114
|
-
</Item>
|
115
|
-
<Item>
|
116
|
-
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
|
117
|
-
</Item>
|
118
|
-
</Array>
|
119
|
-
</Set>
|
120
|
-
</New>
|
121
|
-
</Set>
|
122
|
-
|
123
|
-
<!-- =========================================================== -->
|
124
|
-
<!-- Configure the context deployer -->
|
125
|
-
<!-- A context deployer will deploy contexts described in -->
|
126
|
-
<!-- configuration files discovered in a directory. -->
|
127
|
-
<!-- The configuration directory can be scanned for hot -->
|
128
|
-
<!-- deployments at the configured scanInterval. -->
|
129
|
-
<!-- -->
|
130
|
-
<!-- This deployer is configured to deploy contexts configured -->
|
131
|
-
<!-- in the $JETTY_HOME/contexts directory -->
|
132
|
-
<!-- -->
|
133
|
-
<!-- =========================================================== -->
|
134
|
-
<Call name="addLifeCycle">
|
135
|
-
<Arg>
|
136
|
-
<New class="org.mortbay.jetty.deployer.ContextDeployer">
|
137
|
-
<Set name="contexts"><Ref id="Contexts"/></Set>
|
138
|
-
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
|
139
|
-
<Set name="scanInterval">1</Set>
|
140
|
-
</New>
|
141
|
-
</Arg>
|
142
|
-
</Call>
|
143
|
-
|
144
|
-
<!-- =========================================================== -->
|
145
|
-
<!-- Configure the webapp deployer. -->
|
146
|
-
<!-- A webapp deployer will deploy standard webapps discovered -->
|
147
|
-
<!-- in a directory at startup, without the need for additional -->
|
148
|
-
<!-- configuration files. It does not support hot deploy or -->
|
149
|
-
<!-- non standard contexts (see ContextDeployer above). -->
|
150
|
-
<!-- -->
|
151
|
-
<!-- This deployer is configured to deploy webapps from the -->
|
152
|
-
<!-- $JETTY_HOME/webapps directory -->
|
153
|
-
<!-- -->
|
154
|
-
<!-- Normally only one type of deployer need be used. -->
|
155
|
-
<!-- -->
|
156
|
-
<!-- =========================================================== -->
|
157
|
-
<Call name="addLifeCycle">
|
158
|
-
<Arg>
|
159
|
-
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
|
160
|
-
<Set name="contexts"><Ref id="Contexts"/></Set>
|
161
|
-
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
|
162
|
-
<Set name="parentLoaderPriority">false</Set>
|
163
|
-
<Set name="extract">true</Set>
|
164
|
-
<Set name="allowDuplicates">false</Set>
|
165
|
-
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
|
166
|
-
</New>
|
167
|
-
</Arg>
|
168
|
-
</Call>
|
169
|
-
|
170
|
-
<!-- =========================================================== -->
|
171
|
-
<!-- Configure Authentication Realms -->
|
172
|
-
<!-- Realms may be configured for the entire server here, or -->
|
173
|
-
<!-- they can be configured for a specific web app in a context -->
|
174
|
-
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
|
175
|
-
<!-- example). -->
|
176
|
-
<!-- =========================================================== -->
|
177
|
-
<Set name="UserRealms">
|
178
|
-
<Array type="org.mortbay.jetty.security.UserRealm">
|
179
|
-
<!--
|
180
|
-
<Item>
|
181
|
-
<New class="org.mortbay.jetty.security.HashUserRealm">
|
182
|
-
<Set name="name">Test Realm</Set>
|
183
|
-
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
|
184
|
-
</New>
|
185
|
-
</Item>
|
186
|
-
-->
|
187
|
-
</Array>
|
188
|
-
</Set>
|
189
|
-
|
190
|
-
<!-- =========================================================== -->
|
191
|
-
<!-- Configure Request Log -->
|
192
|
-
<!-- Request logs may be configured for the entire server here, -->
|
193
|
-
<!-- or they can be configured for a specific web app in a -->
|
194
|
-
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
|
195
|
-
<!-- for an example). -->
|
196
|
-
<!-- =========================================================== -->
|
197
|
-
<!--
|
198
|
-
<Ref id="RequestLog">
|
199
|
-
<Set name="requestLog">
|
200
|
-
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
|
201
|
-
<Arg><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Arg>
|
202
|
-
<Set name="retainDays">90</Set>
|
203
|
-
<Set name="append">true</Set>
|
204
|
-
<Set name="extended">false</Set>
|
205
|
-
<Set name="LogTimeZone">GMT</Set>
|
206
|
-
</New>
|
207
|
-
</Set>
|
208
|
-
</Ref>
|
209
|
-
-->
|
210
|
-
|
211
|
-
<!-- =========================================================== -->
|
212
|
-
<!-- extra options -->
|
213
|
-
<!-- =========================================================== -->
|
214
|
-
<Set name="stopAtShutdown">true</Set>
|
215
|
-
<!-- ensure/prevent Server: header being sent to browsers -->
|
216
|
-
<Set name="sendServerVersion">true</Set>
|
217
|
-
|
218
|
-
</Configure>
|
219
|
-
|