outoftime-sunspot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/History.txt +9 -6
  2. data/README.rdoc +45 -13
  3. data/Rakefile +5 -21
  4. data/VERSION.yml +4 -0
  5. data/bin/sunspot-solr +39 -0
  6. data/lib/sunspot/builder.rb +78 -0
  7. data/lib/sunspot/dsl/fields.rb +39 -0
  8. data/lib/sunspot/dsl/query.rb +32 -0
  9. data/lib/sunspot/dsl/scope.rb +35 -0
  10. data/lib/sunspot/dsl.rb +3 -0
  11. data/lib/sunspot/query.rb +9 -20
  12. data/lib/sunspot/search.rb +8 -25
  13. data/lib/sunspot.rb +2 -3
  14. data/solr/etc/jetty.xml +10 -4
  15. data/solr/solr/conf/{admin-extra.html → elevate.xml} +18 -13
  16. data/solr/solr/conf/solrconfig.xml +369 -67
  17. data/solr/webapps/solr.war +0 -0
  18. data/spec/api/build_search_spec.rb +195 -0
  19. data/spec/api/indexer_spec.rb +112 -0
  20. data/spec/api/search_retrieval_spec.rb +59 -0
  21. data/spec/api/session_spec.rb +44 -0
  22. data/spec/api/spec_helper.rb +1 -0
  23. data/spec/api/standard_search_builder_spec.rb +76 -0
  24. data/{test → spec}/custom_expectation.rb +0 -0
  25. data/{test/integration/test_field_types.rb → spec/integration/field_types_spec.rb} +9 -9
  26. data/{test/integration/test_keyword_search.rb → spec/integration/keyword_search_spec.rb} +5 -5
  27. data/spec/integration/spec_helper.rb +1 -0
  28. data/{test → spec}/integration/test_pagination.rb +5 -5
  29. data/{test → spec}/mocks/base_class.rb +0 -0
  30. data/{test → spec}/mocks/comment.rb +0 -0
  31. data/{test → spec}/mocks/mock_adapter.rb +0 -0
  32. data/{test → spec}/mocks/post.rb +0 -0
  33. data/{test/test_helper.rb → spec/spec_helper.rb} +6 -12
  34. data/tasks/gemspec.rake +18 -0
  35. data/tasks/rcov.rake +27 -5
  36. data/tasks/spec.rake +21 -0
  37. metadata +90 -125
  38. data/Manifest.txt +0 -104
  39. data/PostInstall.txt +0 -7
  40. data/config/hoe.rb +0 -74
  41. data/config/requirements.rb +0 -15
  42. data/lib/sunspot/conditions.rb +0 -50
  43. data/lib/sunspot/conditions_builder.rb +0 -37
  44. data/lib/sunspot/field_builder.rb +0 -37
  45. data/lib/sunspot/query_builder.rb +0 -30
  46. data/lib/sunspot/scope_builder.rb +0 -33
  47. data/lib/sunspot/version.rb +0 -10
  48. data/setup.rb +0 -1585
  49. data/solr/README.txt +0 -36
  50. data/solr/exampledocs/books.csv +0 -11
  51. data/solr/exampledocs/hd.xml +0 -46
  52. data/solr/exampledocs/ipod_other.xml +0 -50
  53. data/solr/exampledocs/ipod_video.xml +0 -35
  54. data/solr/exampledocs/mem.xml +0 -58
  55. data/solr/exampledocs/monitor.xml +0 -31
  56. data/solr/exampledocs/monitor2.xml +0 -30
  57. data/solr/exampledocs/mp500.xml +0 -39
  58. data/solr/exampledocs/post.jar +0 -0
  59. data/solr/exampledocs/post.sh +0 -28
  60. data/solr/exampledocs/sd500.xml +0 -33
  61. data/solr/exampledocs/solr.xml +0 -38
  62. data/solr/exampledocs/spellchecker.xml +0 -58
  63. data/solr/exampledocs/utf8-example.xml +0 -42
  64. data/solr/exampledocs/vidcard.xml +0 -52
  65. data/solr/solr/README.txt +0 -52
  66. data/solr/solr/bin/abc +0 -176
  67. data/solr/solr/bin/abo +0 -176
  68. data/solr/solr/bin/backup +0 -108
  69. data/solr/solr/bin/backupcleaner +0 -142
  70. data/solr/solr/bin/commit +0 -128
  71. data/solr/solr/bin/optimize +0 -129
  72. data/solr/solr/bin/readercycle +0 -129
  73. data/solr/solr/bin/rsyncd-disable +0 -77
  74. data/solr/solr/bin/rsyncd-enable +0 -76
  75. data/solr/solr/bin/rsyncd-start +0 -145
  76. data/solr/solr/bin/rsyncd-stop +0 -105
  77. data/solr/solr/bin/scripts-util +0 -83
  78. data/solr/solr/bin/snapcleaner +0 -148
  79. data/solr/solr/bin/snapinstaller +0 -168
  80. data/solr/solr/bin/snappuller +0 -248
  81. data/solr/solr/bin/snappuller-disable +0 -77
  82. data/solr/solr/bin/snappuller-enable +0 -77
  83. data/solr/solr/bin/snapshooter +0 -109
  84. data/solr/solr/conf/scripts.conf +0 -24
  85. data/tasks/deployment.rake +0 -34
  86. data/tasks/environment.rake +0 -7
  87. data/tasks/solr.rake +0 -12
  88. data/tasks/website.rake +0 -17
  89. data/test/api/test_build_search.rb +0 -216
  90. data/test/api/test_helper.rb +0 -4
  91. data/test/api/test_indexer.rb +0 -110
  92. data/test/api/test_retrieve_search.rb +0 -114
  93. data/test/api/test_session.rb +0 -46
  94. data/test/integration/test_helper.rb +0 -1
data/History.txt CHANGED
@@ -1,7 +1,10 @@
1
- == 0.0.1 2008-12-11
1
+ == 0.0.2 2009-02-14
2
+ * Run sunspot's built-in Solr instance using
3
+ sunspot-solr executable
4
+ * Search hash interpretation delegated to
5
+ Builder object
2
6
 
3
- * 1 major enhancement:
4
- * Initial release
5
- * Define indexing for any class using DSL
6
- * Search indexed classes using DSL
7
-
7
+ == 0.0.1 2008-12-11
8
+ * Initial release
9
+ * Define indexing for any class using DSL
10
+ * Search indexed classes using DSL
data/README.rdoc CHANGED
@@ -33,6 +33,22 @@ Sunspot is currently under active development and is not feature-complete.
33
33
  * Access search parameters as hash or object attributes, for easy integration with form helpers or query string builders
34
34
  * Plugins for drop-in integration with Merb and Rails
35
35
 
36
+ == Installation
37
+
38
+ gem sources -a http://gems.github.com
39
+ gem install outoftime-sunspot
40
+
41
+ In order to start the packaged Solr installation, run:
42
+
43
+ sunspot-solr start -- [-d /path/to/data/directory] [-p port]
44
+
45
+ If you don't specify a data directory, your Solr index will be stored in your operating system's temporary directory.
46
+
47
+ You can also run your own instance of Solr wherever you'd like; just copy the solr/config/schema.xml file out of the gem's solr into your installation.
48
+ You can change the URL at which Sunspot accesses Solr with:
49
+
50
+ Sunspot.config.solr.url = 'http://solr.my.host:9818/solr'
51
+
36
52
  == Using Sunspot
37
53
 
38
54
  === Define an index:
@@ -55,40 +71,56 @@ Sunspot is currently under active development and is not feature-complete.
55
71
 
56
72
  === Search for objects:
57
73
 
58
- search = Sunspot.search Post, :conditions => { :average_rating => 3.0 } do
74
+ search = Sunspot.search Post do
59
75
  keywords 'great pizza'
60
76
  with.author_name 'Mark Twain'
61
77
  with.blog_id.any_of [2, 14]
62
78
  with.category_ids.all_of [4, 10]
63
79
  with.published_at.less_than Time.now
64
80
 
65
- conditions.interpret :average_rating, :greater_than
66
- conditions.default :average_rating, 4.0
67
-
68
81
  paginate :page => 3, :per_page => 15
69
82
  order_by :average_rating, :desc
70
83
  end
71
84
 
72
- === Get data and parameters from search:
85
+ === Get data from search:
73
86
 
74
87
  search.results
75
88
  search.total
76
89
  search.page
77
90
  search.per_page
78
- search.keywords
79
- search.conditions.average_rating
80
- search.attributes[:conditions]
81
91
 
82
- == REQUIREMENTS:
92
+ === Build search from a hash (e.g., params) and retrieve them later:
93
+
94
+ search = Sunspot.search Post, :keywords => 'great pizza',
95
+ :conditions => { :author_name => 'Mark Twain',
96
+ :blog_id => [4, 10] },
97
+ :order => 'published_at desc'
98
+ search.builder.keywords
99
+ #=> "great pizza"
100
+ search.builder.conditions.author_name
101
+ #=> "Mark Twain"
102
+ search.builder.params[:conditions][:blog_id]
103
+ #=> [4, 10]
104
+
105
+ This functionality is great for building a search from user input; if you're
106
+ building a search using business logic in your application, the block DSL
107
+ is the way to go. Note you can mix-and-match the two:
108
+
109
+ search = Sunspot.search Post, :keywords => 'great pizza' do
110
+ with.blog_id 1
111
+ end
112
+
113
+ search.builder.keywords
114
+ #=> "great pizza"
115
+ search.builder.blog_id
116
+ #=> nil
117
+
118
+ == Requirements
83
119
 
84
120
  1. extlib
85
121
  2. solr-ruby
86
122
  3. Java
87
123
 
88
- == INSTALL:
89
-
90
- * FIX (sudo gem install, anything else)
91
-
92
124
  == LICENSE:
93
125
 
94
126
  (The MIT License)
data/Rakefile CHANGED
@@ -1,27 +1,11 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/sunspot'
1
+ require 'rubygems'
3
2
 
4
3
  ENV['RUBYOPT'] = '-W1'
5
4
 
6
- # Generate all the Rake tasks
7
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
8
- $hoe = Hoe.new('sunspot', Sunspot::VERSION) do |p|
9
- p.developer('Mat Brown', 'mat@patch.com')
10
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
11
- p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
12
- p.rubyforge_name = p.name # TODO this is default value
13
- # p.extra_deps = [
14
- # ['activesupport','>= 2.0.2'],
15
- # ]
16
- p.extra_dev_deps = [
17
- ['newgem', ">= #{::Newgem::VERSION}"]
18
- ]
19
-
20
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
21
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
22
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
23
- p.rsync_args = '-av --delete --ignore-errors'
5
+ task :environment do
6
+ require File.dirname(__FILE__) + '/lib/sunspot'
24
7
  end
25
8
 
26
- require 'newgem/tasks' # load /tasks/*.rake
27
9
  Dir['tasks/**/*.rake'].each { |t| load t }
10
+
11
+ task :default => :spec
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 2
data/bin/sunspot-solr ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ gem 'daemons', '~> 1.0'
4
+ gem 'optiflag', '~> 0.6.5'
5
+ require 'fileutils'
6
+ require 'tmpdir'
7
+ require 'daemons'
8
+ require 'optiflag'
9
+
10
+ working_directory = FileUtils.pwd
11
+ solr_home = File.join(File.dirname(__FILE__), '..', 'solr')
12
+
13
+ module SolrFlags extend OptiFlagSet
14
+ optional_flag 'p' do
15
+ description 'Port on which to run Solr (default 8983)'
16
+ long_form 'port'
17
+ end
18
+
19
+ optional_flag 'd' do
20
+ description 'Solr data directory'
21
+ end
22
+
23
+ and_process!
24
+ end
25
+
26
+ port = ARGV.flags.p || '8983'
27
+ data_dir = File.expand_path(ARGV.flags.d || File.join(Dir.tmpdir, 'solr_data'))
28
+
29
+ Daemons.run_proc('sunspot-solr') do
30
+ FileUtils.cd(working_directory) do
31
+ FileUtils.cd(solr_home) do
32
+ args = ['java']
33
+ args << "-Djetty.port=#{port}" if port
34
+ args << "-Dsolr.data.dir=#{data_dir}" if data_dir
35
+ args << '-jar' << 'start.jar'
36
+ Kernel.exec(*args)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,78 @@
1
+ module Sunspot
2
+ module Builder
3
+ class AbstractBuilder
4
+ attr_reader :search, :types, :field_names
5
+
6
+ def initialize(query_dsl, types, field_names)
7
+ @search, @types, @field_names = query_dsl, types, field_names
8
+ end
9
+ end
10
+
11
+ class ParamsBuilder < AbstractBuilder
12
+ attr_reader :params
13
+
14
+ def initialize(query_dsl, types, field_names, params = {})
15
+ super(query_dsl, types, field_names)
16
+ @params = params
17
+ params.each_pair do |field_name, value|
18
+ self.send("#{field_name}=", value)
19
+ end
20
+ end
21
+ end
22
+
23
+ class StandardBuilder < ParamsBuilder
24
+ def initialize(query_dsl, types, field_names, params = {})
25
+ params = { :keywords => nil, :conditions => {}, :order => nil, :page => nil, :per_page => nil }.merge(params)
26
+ field_names.each { |field_name| params[:conditions][field_name.to_sym] = nil unless params[:conditions].has_key?(field_name.to_sym) }
27
+ super(query_dsl, types, field_names, params)
28
+ end
29
+
30
+ def keywords=(keywords)
31
+ search.keywords(keywords) if keywords
32
+ end
33
+
34
+ def conditions=(conditions)
35
+ conditions.each_pair do |field_name, value|
36
+ unless value.nil?
37
+ unless value.is_a?(Array)
38
+ search.with.send(field_name, value) if field_names.include?(field_name.to_s)
39
+ else
40
+ search.with.send(field_name).any_of(value)
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ def order=(order_string)
47
+ search.order_by(*order_string.split(' ')) if order_string
48
+ end
49
+
50
+ def page=(page)
51
+ search.paginate(:page => page, :per_page => params[:per_page]) if page
52
+ end
53
+
54
+ def per_page=(per_page) # ugly
55
+ end
56
+
57
+ def keywords
58
+ params[:keywords]
59
+ end
60
+
61
+ def conditions
62
+ ::Sunspot::Util::ClosedStruct.new(params[:conditions])
63
+ end
64
+
65
+ def order
66
+ params[:order]
67
+ end
68
+
69
+ def page
70
+ params[:page]
71
+ end
72
+
73
+ def per_page
74
+ params[:per_page]
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,39 @@
1
+ module Sunspot
2
+ module DSL
3
+ class Fields
4
+ def initialize(clazz)
5
+ @clazz = clazz
6
+ end
7
+
8
+ def text(*names, &block)
9
+ for name in names
10
+ ::Sunspot::Field.register_text clazz, build_field(name, ::Sunspot::Type::TextType, &block)
11
+ end
12
+ end
13
+
14
+ def method_missing(method, *args, &block)
15
+ begin
16
+ type = ::Sunspot::Type.const_get "#{method.to_s.camel_case}Type"
17
+ rescue(NameError)
18
+ super(method.to_sym, *args, &block) and return
19
+ end
20
+ name = args.shift
21
+ ::Sunspot::Field.register clazz, build_field(name, type, *args, &block)
22
+ end
23
+
24
+ protected
25
+ attr_reader :clazz
26
+
27
+ private
28
+
29
+ def build_field(name, type, *args, &block)
30
+ options = args.shift if args.first.is_a?(Hash)
31
+ unless block
32
+ ::Sunspot::Field::AttributeField.new(name, type, options || {})
33
+ else
34
+ ::Sunspot::Field::VirtualField.new(name, type, options || {}, &block)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ module Sunspot
2
+ module DSL
3
+ class Query
4
+ def initialize(query)
5
+ @query = query
6
+ end
7
+
8
+ def keywords(keywords)
9
+ @query.keywords = keywords
10
+ end
11
+
12
+ def with
13
+ @conditions_builder ||= ::Sunspot::DSL::Scope.new(@query)
14
+ end
15
+
16
+ def conditions
17
+ @query.conditions
18
+ end
19
+
20
+ def paginate(options = {})
21
+ page = options.delete(:page) || raise(ArgumentError, "paginate requires a :page argument")
22
+ per_page = options.delete(:per_page)
23
+ raise ArgumentError, "unknown argument #{options.keys.first.inspect} passed to paginate" unless options.empty?
24
+ @query.paginate(page, per_page)
25
+ end
26
+
27
+ def order_by(field_name, direction = nil)
28
+ @query.order_by(field_name, direction)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ module Sunspot
2
+ module DSL
3
+ class Scope
4
+ def initialize(query)
5
+ @query = query
6
+ end
7
+
8
+ def method_missing(field_name, *args)
9
+ if args.length == 0 then RestrictionBuilder.new(field_name, @query)
10
+ elsif args.length == 1 then @query.add_scope @query.build_condition(field_name, ::Sunspot::Restriction::EqualTo, args.first)
11
+ else super(field_name.to_sym, *args)
12
+ end
13
+ end
14
+
15
+ class RestrictionBuilder
16
+ def initialize(field_name, query)
17
+ @field_name, @query = field_name, query
18
+ end
19
+
20
+ def method_missing(condition_name, *args)
21
+ clazz = begin
22
+ ::Sunspot::Restriction.const_get(condition_name.to_s.camel_case)
23
+ rescue(NameError)
24
+ super(condition_name.to_sym, *args)
25
+ end
26
+ if value = args.first
27
+ @query.add_scope @query.build_condition(@field_name, clazz, args.first)
28
+ else
29
+ @query.interpret_condition @field_name, clazz
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ %w(fields query scope).each do |file|
2
+ require File.join(File.dirname(__FILE__), 'dsl', file)
3
+ end
data/lib/sunspot/query.rb CHANGED
@@ -3,14 +3,8 @@ module Sunspot
3
3
  attr_accessor :keywords, :conditions, :rows, :start, :sort
4
4
 
5
5
  def initialize(types, params, configuration)
6
- @keywords, @types, @configuration = params[:keywords], types, configuration
7
- @conditions = Sunspot::Conditions.new(self, params[:conditions] || {})
8
- paginate(params[:page], params[:per_page])
9
- self.order = params[:order] if params[:order]
10
- attributes[:keywords] = @keywords
11
- params[:conditions].each_pair do |field_name, value|
12
- attributes[:conditions][field_name.to_sym] = value
13
- end if params[:conditions]
6
+ @types, @configuration = types, configuration
7
+ paginate
14
8
  end
15
9
 
16
10
  def to_solr
@@ -21,7 +15,7 @@ module Sunspot
21
15
  end
22
16
 
23
17
  def filter_queries
24
- scope_queries + condition_queries
18
+ scope_queries
25
19
  end
26
20
 
27
21
  def add_scope(condition)
@@ -37,7 +31,6 @@ module Sunspot
37
31
  per_page ||= configuration.pagination.default_per_page
38
32
  @start = (page - 1) * per_page
39
33
  @rows = per_page
40
- attributes[:page], attributes[:per_page] = page, per_page
41
34
  end
42
35
 
43
36
  def order=(order)
@@ -47,7 +40,6 @@ module Sunspot
47
40
  def order_by(field_name, direction = nil)
48
41
  direction ||= :asc
49
42
  @sort = [{ field(field_name).indexed_name.to_sym => (direction.to_s == 'asc' ? :ascending : :descending) }] #TODO should support multiple order columns
50
- attributes[:order] = "#{field_name} #{direction}"
51
43
  end
52
44
 
53
45
  def page
@@ -55,11 +47,12 @@ module Sunspot
55
47
  start / rows + 1
56
48
  end
57
49
 
58
- def attributes
59
- @attributes ||= {
60
- :order => nil,
61
- :conditions => fields_hash.keys.inject({}) { |conditions, key| conditions[key.to_sym] = nil; conditions }
62
- }
50
+ def dsl
51
+ @dsl ||= ::Sunspot::DSL::Query.new(self)
52
+ end
53
+
54
+ def build_with(builder_class, *args)
55
+ builder_class.new(dsl, types, fields_hash.keys, *args)
63
56
  end
64
57
 
65
58
  alias_method :per_page, :rows
@@ -77,10 +70,6 @@ module Sunspot
77
70
  scope.map { |condition| condition.to_solr_query }
78
71
  end
79
72
 
80
- def condition_queries
81
- conditions.restrictions.map { |condition| condition.to_solr_query }
82
- end
83
-
84
73
  def types_query
85
74
  if types.nil? || types.empty? then "type:[* TO *]"
86
75
  elsif types.length == 1 then "type:#{types.first}"
@@ -1,13 +1,20 @@
1
1
  module Sunspot
2
2
  class Search
3
+ attr_reader :builder
4
+
3
5
  def initialize(connection, configuration, *types, &block)
4
6
  @connection = connection
5
7
  params = types.last.is_a?(Hash) ? types.pop : {}
6
8
  @query = Sunspot::Query.new(types, params, configuration)
7
- QueryBuilder.new(@query).instance_eval(&block) if block
9
+ @builder = build_with(::Sunspot::Builder::StandardBuilder, params)
10
+ @query.dsl.instance_eval(&block) if block
8
11
  @types = types
9
12
  end
10
13
 
14
+ def build_with(builder_class, *args)
15
+ @query.build_with(builder_class, *args)
16
+ end
17
+
11
18
  def execute!
12
19
  query_options = {}
13
20
  query_options[:filter_queries] = query.filter_queries
@@ -32,30 +39,6 @@ module Sunspot
32
39
  @total ||= @solr_result.total_hits
33
40
  end
34
41
 
35
- def attributes
36
- @query.attributes
37
- end
38
-
39
- def order
40
- @query.attributes[:order]
41
- end
42
-
43
- def page
44
- @query.attributes[:page]
45
- end
46
-
47
- def per_page
48
- @query.attributes[:per_page]
49
- end
50
-
51
- def keywords
52
- @query.attributes[:keywords]
53
- end
54
-
55
- def conditions
56
- ::Sunspot::Util::ClosedStruct.new(@query.attributes[:conditions])
57
- end
58
-
59
42
  protected
60
43
  attr_reader :query, :types, :connection
61
44
 
data/lib/sunspot.rb CHANGED
@@ -1,11 +1,10 @@
1
- require 'rubygems'
2
1
  gem 'solr-ruby'
3
2
  gem 'extlib'
4
3
  require 'solr'
5
4
  require 'extlib'
6
5
  require File.join(File.dirname(__FILE__), 'light_config')
7
6
 
8
- %w(adapters restriction conditions configuration field field_builder indexer query query_builder scope_builder search session type util).each do |filename|
7
+ %w(adapters builder restriction configuration field indexer query search session type util dsl).each do |filename|
9
8
  require File.join(File.dirname(__FILE__), 'sunspot', filename)
10
9
  end
11
10
 
@@ -15,7 +14,7 @@ end
15
14
 
16
15
  class <<Sunspot
17
16
  def setup(clazz, &block)
18
- ::Sunspot::FieldBuilder.new(clazz).instance_eval(&block) if block
17
+ ::Sunspot::DSL::Fields.new(clazz).instance_eval(&block) if block
19
18
  end
20
19
 
21
20
  def index(*objects)
data/solr/etc/jetty.xml CHANGED
@@ -12,6 +12,12 @@
12
12
 
13
13
  <Configure id="Server" class="org.mortbay.jetty.Server">
14
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
+
15
21
  <!-- =========================================================== -->
16
22
  <!-- Server Thread Pool -->
17
23
  <!-- =========================================================== -->
@@ -21,7 +27,7 @@
21
27
  <New class="org.mortbay.thread.BoundedThreadPool">
22
28
  <Set name="minThreads">10</Set>
23
29
  <Set name="lowThreads">50</Set>
24
- <Set name="maxThreads">250</Set>
30
+ <Set name="maxThreads">10000</Set>
25
31
  </New>
26
32
 
27
33
  <!-- Optional Java 5 bounded threadpool with job queue
@@ -64,7 +70,7 @@
64
70
  <Call name="addConnector">
65
71
  <Arg>
66
72
  <New class="org.mortbay.jetty.bio.SocketConnector">
67
- <Set name="port">8983</Set>
73
+ <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
68
74
  <Set name="maxIdleTime">50000</Set>
69
75
  <Set name="lowResourceMaxIdleTime">1500</Set>
70
76
  </New>
@@ -185,13 +191,13 @@
185
191
  <!-- =========================================================== -->
186
192
  <Ref id="RequestLog">
187
193
  <Set name="requestLog">
188
- <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
194
+ <!-- New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
189
195
  <Arg><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Arg>
190
196
  <Set name="retainDays">90</Set>
191
197
  <Set name="append">true</Set>
192
198
  <Set name="extended">false</Set>
193
199
  <Set name="LogTimeZone">GMT</Set>
194
- </New>
200
+ </New -->
195
201
  </Set>
196
202
  </Ref>
197
203
 
@@ -1,3 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
1
2
  <!--
2
3
  Licensed to the Apache Software Foundation (ASF) under one or more
3
4
  contributor license agreements. See the NOTICE file distributed with
@@ -15,17 +16,21 @@
15
16
  limitations under the License.
16
17
  -->
17
18
 
18
- <!-- The content of this page will be statically included into the top
19
- of the admin page. Uncomment this as an example to see there the content
20
- will show up.
21
-
22
- <hr>
23
- <i>This line will appear before the first table</i>
24
- <tr>
25
- <td colspan="2">
26
- This row will be appended to the end of the first table
27
- </td>
28
- </tr>
29
- <hr>
30
-
19
+ <!-- If this file is found in the config directory, it will only be
20
+ loaded once at startup. If it is found in Solr's data
21
+ directory, it will be re-loaded every commit.
31
22
  -->
23
+
24
+ <elevate>
25
+ <query text="foo bar">
26
+ <doc id="1" />
27
+ <doc id="2" />
28
+ <doc id="3" />
29
+ </query>
30
+
31
+ <query text="ipod">
32
+ <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
33
+ <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
34
+ </query>
35
+
36
+ </elevate>