nuatt_sunspot 1.1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +198 -0
- data/LICENSE +18 -0
- data/README.rdoc +239 -0
- data/Rakefile +11 -0
- data/TODO +13 -0
- data/VERSION.yml +4 -0
- data/bin/sunspot-installer +19 -0
- data/bin/sunspot-solr +74 -0
- data/installer/config/schema.yml +95 -0
- data/lib/light_config.rb +40 -0
- data/lib/sunspot.rb +529 -0
- data/lib/sunspot/adapters.rb +265 -0
- data/lib/sunspot/composite_setup.rb +202 -0
- data/lib/sunspot/configuration.rb +46 -0
- data/lib/sunspot/data_extractor.rb +50 -0
- data/lib/sunspot/dsl.rb +5 -0
- data/lib/sunspot/dsl/adjustable.rb +47 -0
- data/lib/sunspot/dsl/field_query.rb +266 -0
- data/lib/sunspot/dsl/fields.rb +113 -0
- data/lib/sunspot/dsl/fulltext.rb +243 -0
- data/lib/sunspot/dsl/function.rb +14 -0
- data/lib/sunspot/dsl/functional.rb +41 -0
- data/lib/sunspot/dsl/more_like_this_query.rb +56 -0
- data/lib/sunspot/dsl/paginatable.rb +28 -0
- data/lib/sunspot/dsl/query_facet.rb +36 -0
- data/lib/sunspot/dsl/restriction.rb +25 -0
- data/lib/sunspot/dsl/scope.rb +229 -0
- data/lib/sunspot/dsl/search.rb +30 -0
- data/lib/sunspot/dsl/standard_query.rb +125 -0
- data/lib/sunspot/field.rb +192 -0
- data/lib/sunspot/field_factory.rb +147 -0
- data/lib/sunspot/indexer.rb +131 -0
- data/lib/sunspot/installer.rb +31 -0
- data/lib/sunspot/installer/library_installer.rb +45 -0
- data/lib/sunspot/installer/schema_builder.rb +219 -0
- data/lib/sunspot/installer/solrconfig_updater.rb +106 -0
- data/lib/sunspot/installer/task_helper.rb +18 -0
- data/lib/sunspot/query.rb +10 -0
- data/lib/sunspot/query/abstract_field_facet.rb +52 -0
- data/lib/sunspot/query/boost_query.rb +24 -0
- data/lib/sunspot/query/common_query.rb +85 -0
- data/lib/sunspot/query/composite_fulltext.rb +31 -0
- data/lib/sunspot/query/connective.rb +191 -0
- data/lib/sunspot/query/date_field_facet.rb +14 -0
- data/lib/sunspot/query/dismax.rb +127 -0
- data/lib/sunspot/query/field_facet.rb +41 -0
- data/lib/sunspot/query/filter.rb +38 -0
- data/lib/sunspot/query/function_query.rb +52 -0
- data/lib/sunspot/query/highlighting.rb +55 -0
- data/lib/sunspot/query/local.rb +26 -0
- data/lib/sunspot/query/more_like_this.rb +60 -0
- data/lib/sunspot/query/more_like_this_query.rb +12 -0
- data/lib/sunspot/query/pagination.rb +38 -0
- data/lib/sunspot/query/query_facet.rb +16 -0
- data/lib/sunspot/query/restriction.rb +262 -0
- data/lib/sunspot/query/scope.rb +9 -0
- data/lib/sunspot/query/sort.rb +95 -0
- data/lib/sunspot/query/sort_composite.rb +33 -0
- data/lib/sunspot/query/standard_query.rb +20 -0
- data/lib/sunspot/query/text_field_boost.rb +17 -0
- data/lib/sunspot/schema.rb +151 -0
- data/lib/sunspot/search.rb +9 -0
- data/lib/sunspot/search/abstract_search.rb +302 -0
- data/lib/sunspot/search/date_facet.rb +35 -0
- data/lib/sunspot/search/facet_row.rb +27 -0
- data/lib/sunspot/search/field_facet.rb +88 -0
- data/lib/sunspot/search/highlight.rb +38 -0
- data/lib/sunspot/search/hit.rb +136 -0
- data/lib/sunspot/search/more_like_this_search.rb +31 -0
- data/lib/sunspot/search/query_facet.rb +62 -0
- data/lib/sunspot/search/standard_search.rb +21 -0
- data/lib/sunspot/server.rb +152 -0
- data/lib/sunspot/session.rb +252 -0
- data/lib/sunspot/session_proxy.rb +71 -0
- data/lib/sunspot/session_proxy/abstract_session_proxy.rb +29 -0
- data/lib/sunspot/session_proxy/class_sharding_session_proxy.rb +66 -0
- data/lib/sunspot/session_proxy/id_sharding_session_proxy.rb +89 -0
- data/lib/sunspot/session_proxy/master_slave_session_proxy.rb +43 -0
- data/lib/sunspot/session_proxy/sharding_session_proxy.rb +215 -0
- data/lib/sunspot/session_proxy/thread_local_session_proxy.rb +37 -0
- data/lib/sunspot/setup.rb +366 -0
- data/lib/sunspot/text_field_setup.rb +29 -0
- data/lib/sunspot/type.rb +340 -0
- data/lib/sunspot/util.rb +253 -0
- data/lib/sunspot/version.rb +3 -0
- data/solr/etc/jetty.xml +214 -0
- data/solr/etc/webdefault.xml +379 -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/servlet-api-2.5-6.1.3.jar +0 -0
- data/solr/solr/conf/admin-extra.html +31 -0
- data/solr/solr/conf/elevate.xml +36 -0
- data/solr/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/solr/conf/protwords.txt +21 -0
- data/solr/solr/conf/schema.xml +240 -0
- data/solr/solr/conf/scripts.conf +24 -0
- data/solr/solr/conf/solrconfig.xml +938 -0
- data/solr/solr/conf/spellings.txt +2 -0
- data/solr/solr/conf/stopwords.es.txt +345 -0
- data/solr/solr/conf/stopwords.txt +58 -0
- data/solr/solr/conf/synonyms.txt +31 -0
- data/solr/solr/lib/lucene-spatial-2.9.1.jar +0 -0
- data/solr/solr/lib/solr-spatial-light-0.0.6.jar +0 -0
- data/solr/start.jar +0 -0
- data/solr/webapps/solr.war +0 -0
- data/spec/api/adapters_spec.rb +33 -0
- data/spec/api/binding_spec.rb +38 -0
- data/spec/api/indexer/attributes_spec.rb +149 -0
- data/spec/api/indexer/batch_spec.rb +46 -0
- data/spec/api/indexer/dynamic_fields_spec.rb +42 -0
- data/spec/api/indexer/fixed_fields_spec.rb +57 -0
- data/spec/api/indexer/fulltext_spec.rb +43 -0
- data/spec/api/indexer/removal_spec.rb +53 -0
- data/spec/api/indexer/spec_helper.rb +1 -0
- data/spec/api/indexer_spec.rb +14 -0
- data/spec/api/query/advanced_manipulation_examples.rb +35 -0
- data/spec/api/query/connectives_examples.rb +176 -0
- data/spec/api/query/dsl_spec.rb +18 -0
- data/spec/api/query/dynamic_fields_examples.rb +165 -0
- data/spec/api/query/faceting_examples.rb +399 -0
- data/spec/api/query/fulltext_examples.rb +315 -0
- data/spec/api/query/function_spec.rb +70 -0
- data/spec/api/query/highlighting_examples.rb +225 -0
- data/spec/api/query/local_examples.rb +38 -0
- data/spec/api/query/more_like_this_spec.rb +140 -0
- data/spec/api/query/ordering_pagination_examples.rb +97 -0
- data/spec/api/query/scope_examples.rb +256 -0
- data/spec/api/query/spec_helper.rb +1 -0
- data/spec/api/query/standard_spec.rb +28 -0
- data/spec/api/query/text_field_scoping_examples.rb +30 -0
- data/spec/api/query/types_spec.rb +20 -0
- data/spec/api/search/dynamic_fields_spec.rb +33 -0
- data/spec/api/search/faceting_spec.rb +356 -0
- data/spec/api/search/highlighting_spec.rb +69 -0
- data/spec/api/search/hits_spec.rb +138 -0
- data/spec/api/search/results_spec.rb +79 -0
- data/spec/api/search/search_spec.rb +23 -0
- data/spec/api/search/spec_helper.rb +1 -0
- data/spec/api/server_spec.rb +91 -0
- data/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +85 -0
- data/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +30 -0
- data/spec/api/session_proxy/master_slave_session_proxy_spec.rb +41 -0
- data/spec/api/session_proxy/sharding_session_proxy_spec.rb +77 -0
- data/spec/api/session_proxy/spec_helper.rb +9 -0
- data/spec/api/session_proxy/thread_local_session_proxy_spec.rb +50 -0
- data/spec/api/session_spec.rb +198 -0
- data/spec/api/spec_helper.rb +3 -0
- data/spec/api/sunspot_spec.rb +18 -0
- data/spec/ext.rb +11 -0
- data/spec/helpers/indexer_helper.rb +29 -0
- data/spec/helpers/query_helper.rb +38 -0
- data/spec/helpers/search_helper.rb +80 -0
- data/spec/integration/dynamic_fields_spec.rb +55 -0
- data/spec/integration/faceting_spec.rb +238 -0
- data/spec/integration/highlighting_spec.rb +22 -0
- data/spec/integration/indexing_spec.rb +33 -0
- data/spec/integration/keyword_search_spec.rb +317 -0
- data/spec/integration/local_search_spec.rb +91 -0
- data/spec/integration/more_like_this_spec.rb +43 -0
- data/spec/integration/scoped_search_spec.rb +324 -0
- data/spec/integration/spec_helper.rb +7 -0
- data/spec/integration/stored_fields_spec.rb +10 -0
- data/spec/integration/test_pagination.rb +32 -0
- data/spec/mocks/adapters.rb +32 -0
- data/spec/mocks/blog.rb +3 -0
- data/spec/mocks/comment.rb +21 -0
- data/spec/mocks/connection.rb +122 -0
- data/spec/mocks/mock_adapter.rb +30 -0
- data/spec/mocks/mock_class_sharding_session_proxy.rb +24 -0
- data/spec/mocks/mock_record.rb +52 -0
- data/spec/mocks/mock_sharding_session_proxy.rb +15 -0
- data/spec/mocks/photo.rb +12 -0
- data/spec/mocks/post.rb +76 -0
- data/spec/mocks/super_class.rb +2 -0
- data/spec/mocks/user.rb +8 -0
- data/spec/spec_helper.rb +52 -0
- data/tasks/gemspec.rake +33 -0
- data/tasks/rcov.rake +28 -0
- data/tasks/rdoc.rake +27 -0
- data/tasks/schema.rake +19 -0
- data/tasks/spec.rake +24 -0
- data/tasks/todo.rake +4 -0
- metadata +355 -0
data/lib/sunspot/util.rb
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
module Sunspot
|
2
|
+
#
|
3
|
+
# The Sunspot::Util module provides utility methods used elsewhere in the
|
4
|
+
# library.
|
5
|
+
#
|
6
|
+
module Util #:nodoc:
|
7
|
+
class <<self
|
8
|
+
#
|
9
|
+
# Get all of the superclasses for a given class, including the class
|
10
|
+
# itself.
|
11
|
+
#
|
12
|
+
# ==== Parameters
|
13
|
+
#
|
14
|
+
# clazz<Class>:: class for which to get superclasses
|
15
|
+
#
|
16
|
+
# ==== Returns
|
17
|
+
#
|
18
|
+
# Array:: Collection containing class and its superclasses
|
19
|
+
#
|
20
|
+
def superclasses_for(clazz)
|
21
|
+
superclasses = [clazz]
|
22
|
+
superclasses << (clazz = clazz.superclass) while clazz.superclass != Object
|
23
|
+
superclasses
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Convert a string to snake case
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
#
|
31
|
+
# string<String>:: String to convert to snake case
|
32
|
+
#
|
33
|
+
# ==== Returns
|
34
|
+
#
|
35
|
+
# String:: String in snake case
|
36
|
+
#
|
37
|
+
def snake_case(string)
|
38
|
+
string.scan(/(^|[A-Z])([^A-Z]+)/).map! { |word| word.join.downcase }.join('_')
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Convert a string to camel case
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
#
|
46
|
+
# string<String>:: String to convert to camel case
|
47
|
+
#
|
48
|
+
# ==== Returns
|
49
|
+
#
|
50
|
+
# String:: String in camel case
|
51
|
+
#
|
52
|
+
def camel_case(string)
|
53
|
+
string.split('_').map! { |word| word.capitalize }.join
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Get a constant from a fully qualified name
|
58
|
+
#
|
59
|
+
# ==== Parameters
|
60
|
+
#
|
61
|
+
# string<String>:: The fully qualified name of a constant
|
62
|
+
#
|
63
|
+
# ==== Returns
|
64
|
+
#
|
65
|
+
# Object:: Value of constant named
|
66
|
+
#
|
67
|
+
def full_const_get(string)
|
68
|
+
string.split('::').inject(Object) do |context, const_name|
|
69
|
+
context.const_defined?(const_name) ? context.const_get(const_name) : context.const_missing(const_name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Evaluate the given proc in the context of the given object if the
|
75
|
+
# block's arity is non-positive, or by passing the given object as an
|
76
|
+
# argument if it is negative.
|
77
|
+
#
|
78
|
+
# ==== Parameters
|
79
|
+
#
|
80
|
+
# object<Object>:: Object to pass to the proc
|
81
|
+
#
|
82
|
+
def instance_eval_or_call(object, &block)
|
83
|
+
if block.arity > 0
|
84
|
+
block.call(object)
|
85
|
+
else
|
86
|
+
ContextBoundDelegate.instance_eval_with_context(object, &block)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def extract_options_from(args)
|
91
|
+
if args.last.is_a?(Hash)
|
92
|
+
args.pop
|
93
|
+
else
|
94
|
+
{}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# Ruby's treatment of Strings as Enumerables is heavily annoying. As far
|
100
|
+
# as I know the behavior of Kernel.Array() is otherwise fine.
|
101
|
+
#
|
102
|
+
def Array(object)
|
103
|
+
case object
|
104
|
+
when String, Hash
|
105
|
+
[object]
|
106
|
+
else
|
107
|
+
super
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Perform a deep merge of hashes, returning the result as a new hash.
|
113
|
+
# See #deep_merge_into for rules used to merge the hashes
|
114
|
+
#
|
115
|
+
# ==== Parameters
|
116
|
+
#
|
117
|
+
# left<Hash>:: Hash to merge
|
118
|
+
# right<Hash>:: The other hash to merge
|
119
|
+
#
|
120
|
+
# ==== Returns
|
121
|
+
#
|
122
|
+
# Hash:: New hash containing the given hashes deep-merged.
|
123
|
+
#
|
124
|
+
def deep_merge(left, right)
|
125
|
+
deep_merge_into({}, left, right)
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Perform a deep merge of the right hash into the left hash
|
130
|
+
#
|
131
|
+
# ==== Parameters
|
132
|
+
#
|
133
|
+
# left:: Hash to receive merge
|
134
|
+
# right:: Hash to merge into left
|
135
|
+
#
|
136
|
+
# ==== Returns
|
137
|
+
#
|
138
|
+
# Hash:: left
|
139
|
+
#
|
140
|
+
def deep_merge!(left, right)
|
141
|
+
deep_merge_into(left, left, right)
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
145
|
+
|
146
|
+
#
|
147
|
+
# Deep merge two hashes into a third hash, using rules that produce nice
|
148
|
+
# merged parameter hashes. The rules are as follows, for a given key:
|
149
|
+
#
|
150
|
+
# * If only one hash has a value, or if both hashes have the same value,
|
151
|
+
# just use the value.
|
152
|
+
# * If either of the values is not a hash, create arrays out of both
|
153
|
+
# values and concatenate them.
|
154
|
+
# * Otherwise, deep merge the two values (which are both hashes)
|
155
|
+
#
|
156
|
+
# ==== Parameters
|
157
|
+
#
|
158
|
+
# destination<Hash>:: Hash into which to perform the merge
|
159
|
+
# left<Hash>:: One hash to merge
|
160
|
+
# right<Hash>:: The other hash to merge
|
161
|
+
#
|
162
|
+
# ==== Returns
|
163
|
+
#
|
164
|
+
# Hash:: destination
|
165
|
+
#
|
166
|
+
def deep_merge_into(destination, left, right)
|
167
|
+
left.each_pair do |name, left_value|
|
168
|
+
right_value = right[name] if right
|
169
|
+
destination[name] =
|
170
|
+
if right_value.nil? || left_value == right_value
|
171
|
+
left_value
|
172
|
+
elsif !left_value.respond_to?(:each_pair) || !right_value.respond_to?(:each_pair)
|
173
|
+
Array(left_value) + Array(right_value)
|
174
|
+
else
|
175
|
+
merged_value = {}
|
176
|
+
deep_merge_into(merged_value, left_value, right_value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
left_keys = Set.new(left.keys)
|
180
|
+
destination.merge!(right.reject { |k, v| left_keys.include?(k) })
|
181
|
+
destination
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
class Coordinates #:nodoc:
|
186
|
+
def initialize(coords)
|
187
|
+
@coords = coords
|
188
|
+
end
|
189
|
+
|
190
|
+
def lat
|
191
|
+
if @coords.respond_to?(:first)
|
192
|
+
@coords.first
|
193
|
+
elsif @coords.respond_to?(:lat)
|
194
|
+
@coords.lat
|
195
|
+
else
|
196
|
+
@coords.latitude
|
197
|
+
end.to_f
|
198
|
+
end
|
199
|
+
|
200
|
+
def lng
|
201
|
+
if @coords.respond_to?(:last)
|
202
|
+
@coords.last
|
203
|
+
elsif @coords.respond_to?(:lng)
|
204
|
+
@coords.lng
|
205
|
+
elsif @coords.respond_to?(:lon)
|
206
|
+
@coords.lon
|
207
|
+
elsif @coords.respond_to?(:long)
|
208
|
+
@coords.long
|
209
|
+
elsif @coords.respond_to?(:longitude)
|
210
|
+
@coords.longitude
|
211
|
+
end.to_f
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
class ContextBoundDelegate
|
216
|
+
class <<self
|
217
|
+
def instance_eval_with_context(receiver, &block)
|
218
|
+
calling_context = eval('self', block.binding)
|
219
|
+
if parent_calling_context = calling_context.instance_eval{@__calling_context__}
|
220
|
+
calling_context = parent_calling_context
|
221
|
+
end
|
222
|
+
new(receiver, calling_context).instance_eval(&block)
|
223
|
+
end
|
224
|
+
private :new
|
225
|
+
end
|
226
|
+
|
227
|
+
BASIC_METHODS = Set[:==, :equal?, :"!", :"!=", :instance_eval,
|
228
|
+
:object_id, :__send__, :__id__]
|
229
|
+
|
230
|
+
instance_methods.each do |method|
|
231
|
+
unless BASIC_METHODS.include?(method.to_sym)
|
232
|
+
undef_method(method)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def initialize(receiver, calling_context)
|
237
|
+
@__receiver__, @__calling_context__ = receiver, calling_context
|
238
|
+
end
|
239
|
+
|
240
|
+
def method_missing(method, *args, &block)
|
241
|
+
begin
|
242
|
+
@__receiver__.send(method.to_sym, *args, &block)
|
243
|
+
rescue ::NoMethodError => e
|
244
|
+
begin
|
245
|
+
@__calling_context__.send(method.to_sym, *args, &block)
|
246
|
+
rescue ::NoMethodError
|
247
|
+
raise(e)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
data/solr/etc/jetty.xml
ADDED
@@ -0,0 +1,214 @@
|
|
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="port"><SystemProperty name="jetty.port" default="8983"/></Set>
|
74
|
+
<Set name="maxIdleTime">50000</Set>
|
75
|
+
<Set name="lowResourceMaxIdleTime">1500</Set>
|
76
|
+
</New>
|
77
|
+
</Arg>
|
78
|
+
</Call>
|
79
|
+
|
80
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
81
|
+
<!-- To add a HTTPS SSL listener -->
|
82
|
+
<!-- see jetty-ssl.xml to add an ssl connector. use -->
|
83
|
+
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
|
84
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
85
|
+
|
86
|
+
<!-- =========================================================== -->
|
87
|
+
<!-- Set up global session ID manager -->
|
88
|
+
<!-- =========================================================== -->
|
89
|
+
<!--
|
90
|
+
<Set name="sessionIdManager">
|
91
|
+
<New class="org.mortbay.jetty.servlet.HashSessionIdManager">
|
92
|
+
<Set name="workerName">node1</Set>
|
93
|
+
</New>
|
94
|
+
</Set>
|
95
|
+
-->
|
96
|
+
|
97
|
+
<!-- =========================================================== -->
|
98
|
+
<!-- Set handler Collection Structure -->
|
99
|
+
<!-- =========================================================== -->
|
100
|
+
<Set name="handler">
|
101
|
+
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
|
102
|
+
<Set name="handlers">
|
103
|
+
<Array type="org.mortbay.jetty.Handler">
|
104
|
+
<Item>
|
105
|
+
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
|
106
|
+
</Item>
|
107
|
+
<Item>
|
108
|
+
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
|
109
|
+
</Item>
|
110
|
+
<Item>
|
111
|
+
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
|
112
|
+
</Item>
|
113
|
+
</Array>
|
114
|
+
</Set>
|
115
|
+
</New>
|
116
|
+
</Set>
|
117
|
+
|
118
|
+
<!-- =========================================================== -->
|
119
|
+
<!-- Configure the context deployer -->
|
120
|
+
<!-- A context deployer will deploy contexts described in -->
|
121
|
+
<!-- configuration files discovered in a directory. -->
|
122
|
+
<!-- The configuration directory can be scanned for hot -->
|
123
|
+
<!-- deployments at the configured scanInterval. -->
|
124
|
+
<!-- -->
|
125
|
+
<!-- This deployer is configured to deploy contexts configured -->
|
126
|
+
<!-- in the $JETTY_HOME/contexts directory -->
|
127
|
+
<!-- -->
|
128
|
+
<!-- =========================================================== -->
|
129
|
+
<Call name="addLifeCycle">
|
130
|
+
<Arg>
|
131
|
+
<New class="org.mortbay.jetty.deployer.ContextDeployer">
|
132
|
+
<Set name="contexts"><Ref id="Contexts"/></Set>
|
133
|
+
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
|
134
|
+
<Set name="scanInterval">1</Set>
|
135
|
+
</New>
|
136
|
+
</Arg>
|
137
|
+
</Call>
|
138
|
+
|
139
|
+
<!-- =========================================================== -->
|
140
|
+
<!-- Configure the webapp deployer. -->
|
141
|
+
<!-- A webapp deployer will deploy standard webapps discovered -->
|
142
|
+
<!-- in a directory at startup, without the need for additional -->
|
143
|
+
<!-- configuration files. It does not support hot deploy or -->
|
144
|
+
<!-- non standard contexts (see ContextDeployer above). -->
|
145
|
+
<!-- -->
|
146
|
+
<!-- This deployer is configured to deploy webapps from the -->
|
147
|
+
<!-- $JETTY_HOME/webapps directory -->
|
148
|
+
<!-- -->
|
149
|
+
<!-- Normally only one type of deployer need be used. -->
|
150
|
+
<!-- -->
|
151
|
+
<!-- =========================================================== -->
|
152
|
+
<Call name="addLifeCycle">
|
153
|
+
<Arg>
|
154
|
+
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
|
155
|
+
<Set name="contexts"><Ref id="Contexts"/></Set>
|
156
|
+
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
|
157
|
+
<Set name="parentLoaderPriority">false</Set>
|
158
|
+
<Set name="extract">true</Set>
|
159
|
+
<Set name="allowDuplicates">false</Set>
|
160
|
+
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
|
161
|
+
</New>
|
162
|
+
</Arg>
|
163
|
+
</Call>
|
164
|
+
|
165
|
+
<!-- =========================================================== -->
|
166
|
+
<!-- Configure Authentication Realms -->
|
167
|
+
<!-- Realms may be configured for the entire server here, or -->
|
168
|
+
<!-- they can be configured for a specific web app in a context -->
|
169
|
+
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
|
170
|
+
<!-- example). -->
|
171
|
+
<!-- =========================================================== -->
|
172
|
+
<Set name="UserRealms">
|
173
|
+
<Array type="org.mortbay.jetty.security.UserRealm">
|
174
|
+
<!--
|
175
|
+
<Item>
|
176
|
+
<New class="org.mortbay.jetty.security.HashUserRealm">
|
177
|
+
<Set name="name">Test Realm</Set>
|
178
|
+
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
|
179
|
+
</New>
|
180
|
+
</Item>
|
181
|
+
-->
|
182
|
+
</Array>
|
183
|
+
</Set>
|
184
|
+
|
185
|
+
<!-- =========================================================== -->
|
186
|
+
<!-- Configure Request Log -->
|
187
|
+
<!-- Request logs may be configured for the entire server here, -->
|
188
|
+
<!-- or they can be configured for a specific web app in a -->
|
189
|
+
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
|
190
|
+
<!-- for an example). -->
|
191
|
+
<!-- =========================================================== -->
|
192
|
+
<!--
|
193
|
+
<Ref id="RequestLog">
|
194
|
+
<Set name="requestLog">
|
195
|
+
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
|
196
|
+
<Arg><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Arg>
|
197
|
+
<Set name="retainDays">90</Set>
|
198
|
+
<Set name="append">true</Set>
|
199
|
+
<Set name="extended">false</Set>
|
200
|
+
<Set name="LogTimeZone">GMT</Set>
|
201
|
+
</New>
|
202
|
+
</Set>
|
203
|
+
</Ref>
|
204
|
+
-->
|
205
|
+
|
206
|
+
<!-- =========================================================== -->
|
207
|
+
<!-- extra options -->
|
208
|
+
<!-- =========================================================== -->
|
209
|
+
<Set name="stopAtShutdown">true</Set>
|
210
|
+
<!-- ensure/prevent Server: header being sent to browsers -->
|
211
|
+
<Set name="sendServerVersion">true</Set>
|
212
|
+
|
213
|
+
</Configure>
|
214
|
+
|