greglu-solr-ruby 0.0.7

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.
Files changed (103) hide show
  1. data/CHANGES.yml +50 -0
  2. data/LICENSE.txt +201 -0
  3. data/README +56 -0
  4. data/Rakefile +190 -0
  5. data/examples/delicious_library/dl_importer.rb +60 -0
  6. data/examples/delicious_library/sample_export.txt +164 -0
  7. data/examples/marc/marc_importer.rb +106 -0
  8. data/examples/tang/tang_importer.rb +58 -0
  9. data/lib/solr.rb +21 -0
  10. data/lib/solr/connection.rb +179 -0
  11. data/lib/solr/document.rb +73 -0
  12. data/lib/solr/exception.rb +13 -0
  13. data/lib/solr/field.rb +39 -0
  14. data/lib/solr/importer.rb +19 -0
  15. data/lib/solr/importer/array_mapper.rb +26 -0
  16. data/lib/solr/importer/delimited_file_source.rb +38 -0
  17. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  18. data/lib/solr/importer/mapper.rb +51 -0
  19. data/lib/solr/importer/solr_source.rb +43 -0
  20. data/lib/solr/importer/xpath_mapper.rb +35 -0
  21. data/lib/solr/indexer.rb +52 -0
  22. data/lib/solr/request.rb +26 -0
  23. data/lib/solr/request/add_document.rb +63 -0
  24. data/lib/solr/request/base.rb +36 -0
  25. data/lib/solr/request/commit.rb +31 -0
  26. data/lib/solr/request/delete.rb +50 -0
  27. data/lib/solr/request/dismax.rb +46 -0
  28. data/lib/solr/request/index_info.rb +22 -0
  29. data/lib/solr/request/modify_document.rb +51 -0
  30. data/lib/solr/request/optimize.rb +21 -0
  31. data/lib/solr/request/ping.rb +36 -0
  32. data/lib/solr/request/select.rb +56 -0
  33. data/lib/solr/request/spellcheck.rb +30 -0
  34. data/lib/solr/request/standard.rb +374 -0
  35. data/lib/solr/request/update.rb +23 -0
  36. data/lib/solr/response.rb +27 -0
  37. data/lib/solr/response/add_document.rb +17 -0
  38. data/lib/solr/response/base.rb +42 -0
  39. data/lib/solr/response/commit.rb +17 -0
  40. data/lib/solr/response/delete.rb +13 -0
  41. data/lib/solr/response/dismax.rb +20 -0
  42. data/lib/solr/response/index_info.rb +26 -0
  43. data/lib/solr/response/modify_document.rb +17 -0
  44. data/lib/solr/response/optimize.rb +14 -0
  45. data/lib/solr/response/ping.rb +28 -0
  46. data/lib/solr/response/ruby.rb +42 -0
  47. data/lib/solr/response/select.rb +17 -0
  48. data/lib/solr/response/spellcheck.rb +20 -0
  49. data/lib/solr/response/standard.rb +60 -0
  50. data/lib/solr/response/xml.rb +42 -0
  51. data/lib/solr/solrtasks.rb +27 -0
  52. data/lib/solr/util.rb +32 -0
  53. data/lib/solr/xml.rb +47 -0
  54. data/script/setup.rb +14 -0
  55. data/script/solrshell +18 -0
  56. data/solr-ruby.gemspec +26 -0
  57. data/solr/conf/admin-extra.html +31 -0
  58. data/solr/conf/protwords.txt +21 -0
  59. data/solr/conf/schema.xml +221 -0
  60. data/solr/conf/scripts.conf +24 -0
  61. data/solr/conf/solrconfig.xml +394 -0
  62. data/solr/conf/stopwords.txt +58 -0
  63. data/solr/conf/synonyms.txt +31 -0
  64. data/solr/conf/xslt/example.xsl +132 -0
  65. data/test/conf/admin-extra.html +31 -0
  66. data/test/conf/protwords.txt +21 -0
  67. data/test/conf/schema.xml +237 -0
  68. data/test/conf/scripts.conf +24 -0
  69. data/test/conf/solrconfig.xml +376 -0
  70. data/test/conf/stopwords.txt +58 -0
  71. data/test/conf/synonyms.txt +31 -0
  72. data/test/functional/server_test.rb +218 -0
  73. data/test/functional/test_solr_server.rb +104 -0
  74. data/test/unit/add_document_test.rb +40 -0
  75. data/test/unit/array_mapper_test.rb +37 -0
  76. data/test/unit/changes_yaml_test.rb +21 -0
  77. data/test/unit/commit_test.rb +41 -0
  78. data/test/unit/connection_test.rb +55 -0
  79. data/test/unit/data_mapper_test.rb +75 -0
  80. data/test/unit/delete_test.rb +56 -0
  81. data/test/unit/delimited_file_source_test.rb +29 -0
  82. data/test/unit/dismax_request_test.rb +26 -0
  83. data/test/unit/document_test.rb +69 -0
  84. data/test/unit/field_test.rb +48 -0
  85. data/test/unit/hpricot_mapper_test.rb +44 -0
  86. data/test/unit/hpricot_test_file.xml +26 -0
  87. data/test/unit/indexer_test.rb +57 -0
  88. data/test/unit/modify_document_test.rb +24 -0
  89. data/test/unit/ping_test.rb +51 -0
  90. data/test/unit/request_test.rb +61 -0
  91. data/test/unit/response_test.rb +43 -0
  92. data/test/unit/select_test.rb +25 -0
  93. data/test/unit/solr_mock_base.rb +40 -0
  94. data/test/unit/spellcheck_response_test.rb +26 -0
  95. data/test/unit/spellchecker_request_test.rb +27 -0
  96. data/test/unit/standard_request_test.rb +324 -0
  97. data/test/unit/standard_response_test.rb +174 -0
  98. data/test/unit/suite.rb +16 -0
  99. data/test/unit/tab_delimited.txt +2 -0
  100. data/test/unit/util_test.rb +24 -0
  101. data/test/unit/xpath_mapper_test.rb +38 -0
  102. data/test/unit/xpath_test_file.xml +25 -0
  103. metadata +173 -0
data/script/setup.rb ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # The ASF licenses this file to You under the Apache License, Version 2.0
3
+ # (the "License"); you may not use this file except in compliance with
4
+ # the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ include Solr
data/script/solrshell ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # The ASF licenses this file to You under the Apache License, Version 2.0
3
+ # (the "License"); you may not use this file except in compliance with
4
+ # the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ solr_lib = File.dirname(__FILE__) + '/../lib/solr'
15
+ setup = File.dirname(__FILE__) + '/setup'
16
+ irb_name = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
17
+
18
+ exec "#{irb_name} -r #{solr_lib} -r #{setup} --simple-prompt"
data/solr-ruby.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{solr-ruby}
5
+ s.version = "0.0.7"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Apache Solr"]
9
+ s.date = %q{2009-03-06}
10
+ s.description = %q{solr-ruby exposes the power of Solr as a Ruby DSL (domain specific language).}
11
+ s.email = %q{ruby-dev@lucene.apache.org}
12
+ s.extra_rdoc_files = ["README", "LICENSE.txt"]
13
+ s.files = ["solr", "solr/conf", "solr/conf/xslt", "solr/conf/xslt/example.xsl", "solr/conf/schema.xml", "solr/conf/protwords.txt", "solr/conf/stopwords.txt", "solr/conf/solrconfig.xml", "solr/conf/scripts.conf", "solr/conf/admin-extra.html", "solr/conf/synonyms.txt", "test", "test/unit", "test/unit/standard_response_test.rb", "test/unit/document_test.rb", "test/unit/select_test.rb", "test/unit/delimited_file_source_test.rb", "test/unit/xpath_test_file.xml", "test/unit/array_mapper_test.rb", "test/unit/solr_mock_base.rb", "test/unit/field_test.rb", "test/unit/modify_document_test.rb", "test/unit/add_document_test.rb", "test/unit/xpath_mapper_test.rb", "test/unit/request_test.rb", "test/unit/commit_test.rb", "test/unit/suite.rb", "test/unit/changes_yaml_test.rb", "test/unit/spellcheck_response_test.rb", "test/unit/ping_test.rb", "test/unit/dismax_request_test.rb", "test/unit/indexer_test.rb", "test/unit/response_test.rb", "test/unit/connection_test.rb", "test/unit/delete_test.rb", "test/unit/tab_delimited.txt", "test/unit/hpricot_test_file.xml", "test/unit/standard_request_test.rb", "test/unit/hpricot_mapper_test.rb", "test/unit/spellchecker_request_test.rb", "test/unit/data_mapper_test.rb", "test/unit/util_test.rb", "test/functional", "test/functional/test_solr_server.rb", "test/functional/server_test.rb", "test/conf", "test/conf/schema.xml", "test/conf/protwords.txt", "test/conf/stopwords.txt", "test/conf/solrconfig.xml", "test/conf/scripts.conf", "test/conf/admin-extra.html", "test/conf/synonyms.txt", "script", "script/setup.rb", "script/solrshell", "lib", "lib/solr", "lib/solr/importer", "lib/solr/importer/delimited_file_source.rb", "lib/solr/importer/solr_source.rb", "lib/solr/importer/array_mapper.rb", "lib/solr/importer/mapper.rb", "lib/solr/importer/xpath_mapper.rb", "lib/solr/importer/hpricot_mapper.rb", "lib/solr/request", "lib/solr/request/ping.rb", "lib/solr/request/spellcheck.rb", "lib/solr/request/select.rb", "lib/solr/request/optimize.rb", "lib/solr/request/standard.rb", "lib/solr/request/delete.rb", "lib/solr/request/index_info.rb", "lib/solr/request/update.rb", "lib/solr/request/dismax.rb", "lib/solr/request/modify_document.rb", "lib/solr/request/add_document.rb", "lib/solr/request/commit.rb", "lib/solr/request/base.rb", "lib/solr/response", "lib/solr/response/ping.rb", "lib/solr/response/spellcheck.rb", "lib/solr/response/select.rb", "lib/solr/response/optimize.rb", "lib/solr/response/standard.rb", "lib/solr/response/xml.rb", "lib/solr/response/ruby.rb", "lib/solr/response/delete.rb", "lib/solr/response/index_info.rb", "lib/solr/response/dismax.rb", "lib/solr/response/modify_document.rb", "lib/solr/response/add_document.rb", "lib/solr/response/commit.rb", "lib/solr/response/base.rb", "lib/solr/util.rb", "lib/solr/document.rb", "lib/solr/exception.rb", "lib/solr/indexer.rb", "lib/solr/response.rb", "lib/solr/connection.rb", "lib/solr/xml.rb", "lib/solr/importer.rb", "lib/solr/field.rb", "lib/solr/solrtasks.rb", "lib/solr/request.rb", "lib/solr.rb", "examples", "examples/marc", "examples/marc/marc_importer.rb", "examples/delicious_library", "examples/delicious_library/sample_export.txt", "examples/delicious_library/dl_importer.rb", "examples/tang", "examples/tang/tang_importer.rb", "LICENSE.txt", "Rakefile", "CHANGES.yml", "README", "solr-ruby.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/greglu/solr-ruby}
16
+ s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{solr-ruby}
19
+ s.rubygems_version = %q{1.3.0}
20
+ s.summary = %q{Ruby library for working with Apache Solr. Packaged and maintained on github by greglu}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+ end
26
+ end
@@ -0,0 +1,31 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
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
+
31
+ -->
@@ -0,0 +1,21 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ #-----------------------------------------------------------------------
14
+ # Use a protected word file to protect against the stemmer reducing two
15
+ # unrelated words to the same base word.
16
+
17
+ # Some non-words that normally won't be encountered,
18
+ # just to test that they won't be stemmed.
19
+ dontstems
20
+ zwhacky
21
+
@@ -0,0 +1,221 @@
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!-- This is the Solr schema file. This file should be named "schema.xml" and
20
+ should be in the conf directory under the solr home
21
+ (i.e. ./solr/conf/schema.xml by default)
22
+ or located where the classloader for the Solr webapp can find it.
23
+
24
+ For more information, on how to customize this file, please see
25
+ http://wiki.apache.org/solr/SchemaXml
26
+ -->
27
+
28
+ <schema name="flare" version="1.1">
29
+ <!-- attribute "name" is the name of this schema and is only used for display purposes.
30
+ Applications should change this to reflect the nature of the search collection.
31
+ version="1.1" is Solr's version number for the schema syntax and semantics. It should
32
+ not normally be changed by applications.
33
+ 1.0: multiValued attribute did not exist, all fields are multiValued by nature
34
+ 1.1: multiValued attribute introduced, false by default -->
35
+
36
+ <types>
37
+ <!-- field type definitions. The "name" attribute is
38
+ just a label to be used by field definitions. The "class"
39
+ attribute and any other attributes determine the real
40
+ behavior of the fieldtype.
41
+ Class names starting with "solr" refer to java classes in the
42
+ org.apache.solr.analysis package.
43
+ -->
44
+
45
+ <!-- The StrField type is not analyzed, but indexed/stored verbatim.
46
+ - StrField and TextField support an optional compressThreshold which
47
+ limits compression (if enabled in the derived fields) to values which
48
+ exceed a certain size (in characters).
49
+ -->
50
+ <fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
51
+
52
+ <!-- boolean type: "true" or "false" -->
53
+ <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
54
+
55
+ <!-- The optional sortMissingLast and sortMissingFirst attributes are
56
+ currently supported on types that are sorted internally as strings.
57
+ - If sortMissingLast="true", then a sort on this field will cause documents
58
+ without the field to come after documents with the field,
59
+ regardless of the requested sort order (asc or desc).
60
+ - If sortMissingFirst="true", then a sort on this field will cause documents
61
+ without the field to come before documents with the field,
62
+ regardless of the requested sort order.
63
+ - If sortMissingLast="false" and sortMissingFirst="false" (the default),
64
+ then default lucene sorting will be used which places docs without the
65
+ field first in an ascending sort and last in a descending sort.
66
+ -->
67
+
68
+
69
+ <!-- numeric field types that store and index the text
70
+ value verbatim (and hence don't support range queries, since the
71
+ lexicographic ordering isn't equal to the numeric ordering) -->
72
+ <fieldtype name="integer" class="solr.IntField" omitNorms="true"/>
73
+ <fieldtype name="long" class="solr.LongField" omitNorms="true"/>
74
+ <fieldtype name="float" class="solr.FloatField" omitNorms="true"/>
75
+ <fieldtype name="double" class="solr.DoubleField" omitNorms="true"/>
76
+
77
+
78
+ <!-- Numeric field types that manipulate the value into
79
+ a string value that isn't human-readable in its internal form,
80
+ but with a lexicographic ordering the same as the numeric ordering,
81
+ so that range queries work correctly. -->
82
+ <fieldtype name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
83
+ <fieldtype name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
84
+ <fieldtype name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
85
+ <fieldtype name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
86
+
87
+
88
+ <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
89
+ is a more restricted form of the canonical representation of dateTime
90
+ http://www.w3.org/TR/xmlschema-2/#dateTime
91
+ The trailing "Z" designates UTC time and is mandatory.
92
+ Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
93
+ All other components are mandatory.
94
+
95
+ Expressions can also be used to denote calculations that should be
96
+ performed relative to "NOW" to determine the value, ie...
97
+
98
+ NOW/HOUR
99
+ ... Round to the start of the current hour
100
+ NOW-1DAY
101
+ ... Exactly 1 day prior to now
102
+ NOW/DAY+6MONTHS+3DAYS
103
+ ... 6 months and 3 days in the future from the start of
104
+ the current day
105
+
106
+ Consult the DateField javadocs for more information.
107
+ -->
108
+ <fieldtype name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
109
+
110
+ <!-- solr.TextField allows the specification of custom text analyzers
111
+ specified as a tokenizer and a list of token filters. Different
112
+ analyzers may be specified for indexing and querying.
113
+
114
+ The optional positionIncrementGap puts space between multiple fields of
115
+ this type on the same document, with the purpose of preventing false phrase
116
+ matching across fields.
117
+
118
+ For more info on customizing your analyzer chain, please see
119
+ http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
120
+ -->
121
+
122
+ <!-- One can also specify an existing Analyzer class that has a
123
+ default constructor via the class attribute on the analyzer element
124
+ <fieldtype name="text_greek" class="solr.TextField">
125
+ <analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
126
+ </fieldType>
127
+ -->
128
+
129
+ <!-- A text field that only splits on whitespace for exact matching of words -->
130
+ <fieldtype name="text_ws" class="solr.TextField" positionIncrementGap="100">
131
+ <analyzer>
132
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
133
+ </analyzer>
134
+ </fieldtype>
135
+
136
+ <fieldtype name="text" class="solr.TextField" positionIncrementGap="100">
137
+ <analyzer>
138
+ <tokenizer class="solr.StandardTokenizerFactory"/>
139
+ <filter class="solr.StandardFilterFactory"/>
140
+ <filter class="solr.LowerCaseFilterFactory"/>
141
+ </analyzer>
142
+ </fieldtype>
143
+
144
+ <fieldtype name="text_zh" class="solr.TextField">
145
+ <analyzer class="org.apache.lucene.analysis.cn.ChineseAnalyzer"/>
146
+ </fieldtype>
147
+
148
+
149
+ <!-- Less flexible matching, but less false matches. Probably not ideal for product names,
150
+ but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
151
+ <fieldtype name="textTight" class="solr.TextField" positionIncrementGap="100" >
152
+ <analyzer>
153
+ <tokenizer class="solr.WhitespaceTokenizerFactory"/>
154
+ <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
155
+ <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
156
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
157
+ <filter class="solr.LowerCaseFilterFactory"/>
158
+ <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
159
+ <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
160
+ </analyzer>
161
+ </fieldtype>
162
+
163
+ </types>
164
+
165
+
166
+ <fields>
167
+ <!-- Valid attributes for fields:
168
+ name: mandatory - the name for the field
169
+ type: mandatory - the name of a previously defined type from the <types> section
170
+ indexed: true if this field should be indexed (searchable or sortable)
171
+ stored: true if this field should be retrievable
172
+ compressed: [false] if this field should be stored using gzip compression
173
+ (this will only apply if the field type is compressable; among
174
+ the standard field types, only TextField and StrField are)
175
+ multiValued: true if this field may contain multiple values per document
176
+ omitNorms: (expert) set to true to omit the norms associated with
177
+ this field (this disables length normalization and index-time
178
+ boosting for the field, and saves some memory). Only full-text
179
+ fields or fields that need an index-time boost need norms.
180
+ -->
181
+
182
+ <field name="id" type="string" indexed="true" stored="true"/>
183
+
184
+ <!-- catchall field, containing all other searchable text fields (implemented
185
+ via copyField further on in this schema -->
186
+ <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
187
+
188
+ <!-- Dynamic field definitions. If a field name is not found, dynamicFields
189
+ will be used if the name matches any of the patterns.
190
+ RESTRICTION: the glob-like pattern in the name attribute must have
191
+ a "*" only at the start or the end.
192
+ EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
193
+ Longer patterns will be matched first. if equal size patterns
194
+ both match, the first appearing in the schema will be used. -->
195
+ <dynamicField name="*_facet" type="string" indexed="true" stored="true" multiValued="true"/>
196
+ <dynamicField name="*_zh_text" type="text_zh" indexed="true" stored="true" multiValued="true"/>
197
+ <dynamicField name="*_text" type="text" indexed="true" stored="true" multiValued="true"/>
198
+ <dynamicField name="*_display" type="text" indexed="false" stored="true" multiValued="true"/>
199
+ </fields>
200
+
201
+ <!-- field to use to determine and enforce document uniqueness. -->
202
+ <uniqueKey>id</uniqueKey>
203
+
204
+ <!-- field for the QueryParser to use when an explicit fieldname is absent -->
205
+ <defaultSearchField>text</defaultSearchField>
206
+
207
+ <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
208
+ <solrQueryParser defaultOperator="AND"/>
209
+
210
+ <!-- copyField commands copy one field to another at the time a document
211
+ is added to the index. It's used either to index the same field differently,
212
+ or to add multiple fields to the same field for easier/faster searching. -->
213
+ <copyField source="*_text" dest="text"/>
214
+ <copyField source="*_facet" dest="text"/>
215
+
216
+ <!-- Similarity is the scoring routine for each document vs. a query.
217
+ A custom similarity may be specified here, but the default is fine
218
+ for most applications. -->
219
+ <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
220
+
221
+ </schema>
@@ -0,0 +1,24 @@
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
+ user=
17
+ solr_hostname=localhost
18
+ solr_port=8983
19
+ rsyncd_port=18983
20
+ data_dir=
21
+ webapp_name=solr
22
+ master_host=
23
+ master_data_dir=
24
+ master_status_dir=
@@ -0,0 +1,394 @@
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <config>
20
+ <!-- Set this to 'false' if you want solr to continue working after it has
21
+ encountered an severe configuration error. In a production environment,
22
+ you may want solr to keep working even if one handler is mis-configured.
23
+
24
+ You may also set this to false using by setting the system property:
25
+ -Dsolr.abortOnConfigurationError=false
26
+ -->
27
+ <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
28
+
29
+ <!-- Used to specify an alternate directory to hold all index data
30
+ other than the default ./data under the Solr home.
31
+ If replication is in use, this should match the replication configuration. -->
32
+ <dataDir>${solr.data.dir:./solr/data}</dataDir>
33
+
34
+ <indexDefaults>
35
+ <!-- Values here affect all index writers and act as a default unless overridden. -->
36
+ <useCompoundFile>false</useCompoundFile>
37
+ <ramBufferSizeMB>32</ramBufferSizeMB>
38
+ <mergeFactor>10</mergeFactor>
39
+ <maxMergeDocs>2147483647</maxMergeDocs>
40
+ <maxFieldLength>10000</maxFieldLength>
41
+ <writeLockTimeout>1000</writeLockTimeout>
42
+ <commitLockTimeout>10000</commitLockTimeout>
43
+ </indexDefaults>
44
+
45
+ <mainIndex>
46
+ <!-- options specific to the main on-disk lucene index -->
47
+ <useCompoundFile>false</useCompoundFile>
48
+ <ramBufferSizeMB>32</ramBufferSizeMB>
49
+ <mergeFactor>10</mergeFactor>
50
+ <maxMergeDocs>2147483647</maxMergeDocs>
51
+ <maxFieldLength>10000</maxFieldLength>
52
+
53
+ <!-- If true, unlock any held write or commit locks on startup.
54
+ This defeats the locking mechanism that allows multiple
55
+ processes to safely access a lucene index, and should be
56
+ used with care. -->
57
+ <unlockOnStartup>false</unlockOnStartup>
58
+ </mainIndex>
59
+
60
+ <!-- the default high-performance update handler -->
61
+ <updateHandler class="solr.DirectUpdateHandler2">
62
+
63
+ <!-- A prefix of "solr." for class names is an alias that
64
+ causes solr to search appropriate packages, including
65
+ org.apache.solr.(search|update|request|core|analysis)
66
+ -->
67
+
68
+ <!-- autocommit pending docs if certain criteria are met
69
+ <autoCommit>
70
+ <maxDocs>10000</maxDocs>
71
+ <maxTime>1000</maxTime>
72
+ </autoCommit>
73
+ -->
74
+
75
+ <!-- The RunExecutableListener executes an external command.
76
+ exe - the name of the executable to run
77
+ dir - dir to use as the current working directory. default="."
78
+ wait - the calling thread waits until the executable returns. default="true"
79
+ args - the arguments to pass to the program. default=nothing
80
+ env - environment variables to set. default=nothing
81
+ -->
82
+ <!-- A postCommit event is fired after every commit or optimize command
83
+ <listener event="postCommit" class="solr.RunExecutableListener">
84
+ <str name="exe">snapshooter</str>
85
+ <str name="dir">solr/bin</str>
86
+ <bool name="wait">true</bool>
87
+ <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
88
+ <arr name="env"> <str>MYVAR=val1</str> </arr>
89
+ </listener>
90
+ -->
91
+ <!-- A postOptimize event is fired only after every optimize command, useful
92
+ in conjunction with index distribution to only distribute optimized indicies
93
+ <listener event="postOptimize" class="solr.RunExecutableListener">
94
+ <str name="exe">snapshooter</str>
95
+ <str name="dir">solr/bin</str>
96
+ <bool name="wait">true</bool>
97
+ </listener>
98
+ -->
99
+
100
+ </updateHandler>
101
+
102
+
103
+ <query>
104
+ <!-- Maximum number of clauses in a boolean query... can affect
105
+ range or prefix queries that expand to big boolean
106
+ queries. An exception is thrown if exceeded. -->
107
+ <maxBooleanClauses>1024</maxBooleanClauses>
108
+
109
+
110
+ <!-- Cache used by SolrIndexSearcher for filters (DocSets),
111
+ unordered sets of *all* documents that match a query.
112
+ When a new searcher is opened, its caches may be prepopulated
113
+ or "autowarmed" using data from caches in the old searcher.
114
+ autowarmCount is the number of items to prepopulate. For LRUCache,
115
+ the autowarmed items will be the most recently accessed items.
116
+ Parameters:
117
+ class - the SolrCache implementation (currently only LRUCache)
118
+ size - the maximum number of entries in the cache
119
+ initialSize - the initial capacity (number of entries) of
120
+ the cache. (seel java.util.HashMap)
121
+ autowarmCount - the number of entries to prepopulate from
122
+ and old cache.
123
+ -->
124
+ <filterCache
125
+ class="solr.LRUCache"
126
+ size="512"
127
+ initialSize="512"
128
+ autowarmCount="256"/>
129
+
130
+ <!-- queryResultCache caches results of searches - ordered lists of
131
+ document ids (DocList) based on a query, a sort, and the range
132
+ of documents requested. -->
133
+ <queryResultCache
134
+ class="solr.LRUCache"
135
+ size="512"
136
+ initialSize="512"
137
+ autowarmCount="256"/>
138
+
139
+ <!-- documentCache caches Lucene Document objects (the stored fields for each document).
140
+ Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
141
+ <documentCache
142
+ class="solr.LRUCache"
143
+ size="512"
144
+ initialSize="512"
145
+ autowarmCount="0"/>
146
+
147
+ <!-- If true, stored fields that are not requested will be loaded lazily.
148
+ -->
149
+ <enableLazyFieldLoading>false</enableLazyFieldLoading>
150
+
151
+ <!-- Example of a generic cache. These caches may be accessed by name
152
+ through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
153
+ The purpose is to enable easy caching of user/application level data.
154
+ The regenerator argument should be specified as an implementation
155
+ of solr.search.CacheRegenerator if autowarming is desired. -->
156
+ <!--
157
+ <cache name="myUserCache"
158
+ class="solr.LRUCache"
159
+ size="4096"
160
+ initialSize="1024"
161
+ autowarmCount="1024"
162
+ regenerator="org.mycompany.mypackage.MyRegenerator"
163
+ />
164
+ -->
165
+
166
+ <!-- An optimization that attempts to use a filter to satisfy a search.
167
+ If the requested sort does not include score, then the filterCache
168
+ will be checked for a filter matching the query. If found, the filter
169
+ will be used as the source of document ids, and then the sort will be
170
+ applied to that.
171
+ <useFilterForSortedQuery>true</useFilterForSortedQuery>
172
+ -->
173
+
174
+ <!-- An optimization for use with the queryResultCache. When a search
175
+ is requested, a superset of the requested number of document ids
176
+ are collected. For example, if a search for a particular query
177
+ requests matching documents 10 through 19, and queryWindowSize is 50,
178
+ then documents 0 through 50 will be collected and cached. Any further
179
+ requests in that range can be satisfied via the cache. -->
180
+ <queryResultWindowSize>10</queryResultWindowSize>
181
+
182
+ <!-- This entry enables an int hash representation for filters (DocSets)
183
+ when the number of items in the set is less than maxSize. For smaller
184
+ sets, this representation is more memory efficient, more efficient to
185
+ iterate over, and faster to take intersections. -->
186
+ <HashDocSet maxSize="3000" loadFactor="0.75"/>
187
+
188
+
189
+ <!-- boolToFilterOptimizer converts boolean clauses with zero boost
190
+ into cached filters if the number of docs selected by the clause exceeds
191
+ the threshold (represented as a fraction of the total index) -->
192
+ <boolTofilterOptimizer enabled="true" cacheSize="32" threshold=".05"/>
193
+
194
+
195
+ <!-- a newSearcher event is fired whenever a new searcher is being prepared
196
+ and there is a current searcher handling requests (aka registered). -->
197
+ <!-- QuerySenderListener takes an array of NamedList and executes a
198
+ local query request for each NamedList in sequence. -->
199
+ <!--
200
+ <listener event="newSearcher" class="solr.QuerySenderListener">
201
+ <arr name="queries">
202
+ <lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
203
+ <lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
204
+ </arr>
205
+ </listener>
206
+ -->
207
+
208
+ <!-- a firstSearcher event is fired whenever a new searcher is being
209
+ prepared but there is no current registered searcher to handle
210
+ requests or to gain autowarming data from. -->
211
+ <!--
212
+ <listener event="firstSearcher" class="solr.QuerySenderListener">
213
+ <arr name="queries">
214
+ <lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
215
+ </arr>
216
+ </listener>
217
+ -->
218
+
219
+ <!-- If a search request comes in and there is no current registered searcher,
220
+ then immediately register the still warming searcher and use it. If
221
+ "false" then all requests will block until the first searcher is done
222
+ warming. -->
223
+ <useColdSearcher>false</useColdSearcher>
224
+
225
+ <!-- Maximum number of searchers that may be warming in the background
226
+ concurrently. An error is returned if this limit is exceeded. Recommend
227
+ 1-2 for read-only slaves, higher for masters w/o cache warming. -->
228
+ <maxWarmingSearchers>4</maxWarmingSearchers>
229
+
230
+ </query>
231
+
232
+ <!--
233
+ Let the dispatch filter handler /select?qt=XXX
234
+ handleSelect=true will use consistent error handling for /select and /update
235
+ handleSelect=false will use solr1.1 style error formatting
236
+ -->
237
+ <requestDispatcher handleSelect="true" >
238
+ <!--Make sure your system has some authentication before enabling remote streaming! -->
239
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
240
+ </requestDispatcher>
241
+
242
+
243
+ <!-- requestHandler plugins... incoming queries will be dispatched to the
244
+ correct handler based on the qt (query type) param matching the
245
+ name of registered handlers.
246
+ The "standard" request handler is the default and will be used if qt
247
+ is not specified in the request.
248
+ -->
249
+ <requestHandler name="standard" class="solr.StandardRequestHandler">
250
+ <!-- default values for query parameters -->
251
+ <lst name="defaults">
252
+ <str name="echoParams">explicit</str>
253
+ <!--
254
+ <int name="rows">10</int>
255
+ <str name="fl">*</str>
256
+ <str name="version">2.1</str>
257
+ -->
258
+ </lst>
259
+ </requestHandler>
260
+
261
+
262
+
263
+
264
+ <requestHandler name="browse" class="solr.DisMaxRequestHandler" >
265
+ <lst name="defaults">
266
+ <str name="echoParams">explicit</str>
267
+ <str name="qf">text^1.0 title_text^2.0 description_text^1.5 id^10.0</str>
268
+ <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
269
+ <str name="q.alt">*:*</str>
270
+ </lst>
271
+ <!-- In addition to defaults, "appends" params can be specified
272
+ to identify values which should be appended to the list of
273
+ multi-val params from the query (or the existing "defaults").
274
+
275
+ In this example, the param "fq=instock:true" will be appended to
276
+ any query time fq params the user may specify, as a mechanism for
277
+ partitioning the index, independent of any user selected filtering
278
+ that may also be desired (perhaps as a result of faceted searching).
279
+
280
+ NOTE: there is *absolutely* nothing a client can do to prevent these
281
+ "appends" values from being used, so don't use this mechanism
282
+ unless you are sure you always want it.
283
+ -->
284
+ <lst name="appends">
285
+ </lst>
286
+ <!-- "invariants" are a way of letting the Solr maintainer lock down
287
+ the options available to Solr clients. Any params values
288
+ specified here are used regardless of what values may be specified
289
+ in either the query, the "defaults", or the "appends" params.
290
+
291
+ In this example, the facet.field and facet.query params are fixed,
292
+ limiting the facets clients can use. Faceting is not turned on by
293
+ default - but if the client does specify facet=true in the request,
294
+ these are the only facets they will be able to see counts for;
295
+ regardless of what other facet.field or facet.query params they
296
+ may specify.
297
+
298
+ NOTE: there is *absolutely* nothing a client can do to prevent these
299
+ "invariants" values from being used, so don't use this mechanism
300
+ unless you are sure you always want it.
301
+ -->
302
+ <lst name="invariants">
303
+ <str name="facet">on</str>
304
+ <str name="facet.mincount">1</str>
305
+ <str name="facet.field">genre_facet</str>
306
+ <str name="facet.field">medium_facet</str>
307
+ <str name="facet.field">rating_facet</str>
308
+ <str name="facet.field">publisher_facet</str>
309
+ </lst>
310
+ </requestHandler>
311
+
312
+
313
+ <!-- SpellCheckerRequestHandler takes in a word (or several words) as the
314
+ value of the "q" parameter and returns a list of alternative spelling
315
+ suggestions. If invoked with a ...&cmd=rebuild, it will rebuild the
316
+ spellchecker index.
317
+ -->
318
+ <requestHandler name="spellchecker" class="solr.SpellCheckerRequestHandler">
319
+ <!-- default values for query parameters -->
320
+ <lst name="defaults">
321
+ <int name="suggestionCount">1</int>
322
+ <float name="accuracy">0.5</float>
323
+ </lst>
324
+
325
+ <!-- Main init params for handler -->
326
+
327
+ <!-- The directory where your SpellChecker Index should live. -->
328
+ <!-- May be absolute, or relative to the Solr "dataDir" directory. -->
329
+ <!-- If this option is not specified, a RAM directory will be used -->
330
+ <str name="spellcheckerIndexDir">spell</str>
331
+
332
+ <!-- the field in your schema that you want to be able to build -->
333
+ <!-- your spell index on. This should be a field that uses a very -->
334
+ <!-- simple FieldType without a lot of Analysis (ie: string) -->
335
+ <str name="termSourceField">word</str>
336
+
337
+ </requestHandler>
338
+
339
+
340
+ <!-- Update request handler.
341
+
342
+ Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
343
+ the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
344
+ The response format differs from solr1.1 formatting and returns a standard error code.
345
+
346
+ To enable solr1.1 behavior, remove the /update handler or change its path
347
+ -->
348
+ <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
349
+
350
+ <!-- CSV update handler, loaded on demand -->
351
+ <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
352
+
353
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
354
+
355
+ <!-- Echo the request contents back to the client -->
356
+ <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
357
+ <lst name="defaults">
358
+ <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
359
+ <str name="echoHandler">true</str>
360
+ </lst>
361
+ </requestHandler>
362
+
363
+ <!-- queryResponseWriter plugins... query responses will be written using the
364
+ writer specified by the 'wt' request parameter matching the name of a registered
365
+ writer.
366
+ The "standard" writer is the default and will be used if 'wt' is not specified
367
+ in the request. XMLResponseWriter will be used if nothing is specified here.
368
+ The json, python, and ruby writers are also available by default.
369
+
370
+ <queryResponseWriter name="standard" class="org.apache.solr.request.XMLResponseWriter"/>
371
+ <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
372
+ <queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
373
+ <queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
374
+
375
+ <queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
376
+ -->
377
+
378
+ <!-- XSLT response writer transforms the XML output by any xslt file found
379
+ in Solr's conf/xslt directory. Changes to xslt files are checked for
380
+ every xsltCacheLifetimeSeconds.
381
+ -->
382
+ <queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
383
+ <int name="xsltCacheLifetimeSeconds">5</int>
384
+ </queryResponseWriter>
385
+
386
+ <!-- config for the admin interface -->
387
+ <admin>
388
+ <defaultQuery>solr</defaultQuery>
389
+ <!-- configure a healthcheck file for servers behind a loadbalancer
390
+ <healthcheck type="file">server-enabled</healthcheck>
391
+ -->
392
+ </admin>
393
+
394
+ </config>