multi-solr 01.01.05

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +1 -0
  5. data/lib/multi_solr/base_searcher.rb +393 -0
  6. data/lib/multi_solr/filter_value_composite.rb +33 -0
  7. data/lib/multi_solr/rails_form_render_helper.rb +84 -0
  8. data/lib/multi_solr/search_request.rb +209 -0
  9. data/lib/multi_solr/search_result.rb +127 -0
  10. data/lib/multi_solr/single_core_handler.rb +341 -0
  11. data/lib/multi_solr/solr_filter_collection.rb +97 -0
  12. data/lib/multi_solr/solr_filter_date.rb +46 -0
  13. data/lib/multi_solr/solr_filter_date_range.rb +62 -0
  14. data/lib/multi_solr/solr_filter_free_query.rb +11 -0
  15. data/lib/multi_solr/solr_filter_simple.rb +96 -0
  16. data/lib/multi_solr/timeline_core_handler.rb +131 -0
  17. data/lib/multi_solr/version.rb +3 -0
  18. data/lib/multi_solr.rb +43 -0
  19. data/multi-solr.gemspec +28 -0
  20. data/spec/fixtures/solr-testdata.yml +13 -0
  21. data/spec/multi_solr/base_searcher_spec.rb +212 -0
  22. data/spec/multi_solr/search_request_spec.rb +45 -0
  23. data/spec/multi_solr/search_result_spec.rb +113 -0
  24. data/spec/multi_solr/single_core_handler_spec.rb +169 -0
  25. data/spec/multi_solr/timeline_core_handler_spec.rb +107 -0
  26. data/spec/solr_test_helper.rb +15 -0
  27. data/spec/solr_testdata_provider.rb +89 -0
  28. data/spec/spec_helper.rb +27 -0
  29. data/test-solr/.gitignore +4 -0
  30. data/test-solr/articles.xml +6 -0
  31. data/test-solr/etc/jetty.xml +227 -0
  32. data/test-solr/etc/webdefault.xml +410 -0
  33. data/test-solr/lib/jetty-6.1.26-patched-JETTY-1340.jar +0 -0
  34. data/test-solr/lib/jetty-LICENSE.txt +202 -0
  35. data/test-solr/lib/jetty-NOTICE.txt +36 -0
  36. data/test-solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar +0 -0
  37. data/test-solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  38. data/test-solr/lib/jsp-2.1/jsp-2.1-glassfish-2.1.v20091210.jar +0 -0
  39. data/test-solr/lib/jsp-2.1/jsp-2.1-jetty-6.1.26.jar +0 -0
  40. data/test-solr/lib/jsp-2.1/jsp-api-2.1-glassfish-2.1.v20091210.jar +0 -0
  41. data/test-solr/lib/lukeall-3.4.0_1.jar +0 -0
  42. data/test-solr/lib/servlet-api-2.5-20081211.jar +0 -0
  43. data/test-solr/solr/lib/apache-solr-dataimporthandler-3.4.0.jar +0 -0
  44. data/test-solr/solr/solr.xml +20 -0
  45. data/test-solr/solr/testcore/conf/dataimport-test.xml +12 -0
  46. data/test-solr/solr/testcore/conf/schema.xml +42 -0
  47. data/test-solr/solr/testcore/conf/solr_schema.css +58 -0
  48. data/test-solr/solr/testcore/conf/solr_schema.xsl +72 -0
  49. data/test-solr/solr/testcore/conf/solrconfig.xml +72 -0
  50. data/test-solr/start-test-solr.sh +10 -0
  51. data/test-solr/start.jar +0 -0
  52. data/test-solr/webapps/solr.war +0 -0
  53. metadata +212 -0
Binary file
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+
3
+ <!--
4
+ All (relative) paths are relative to the installation path
5
+
6
+ persistent: Save changes made via the API to this file
7
+ sharedLib: path to a lib directory that will be shared across all cores
8
+ -->
9
+ <solr persistent="false" sharedLib="lib">
10
+
11
+ <!--
12
+ adminPath: RequestHandler path to manage cores.
13
+ If 'null' (or absent), cores will not be manageable via request handler
14
+ -->
15
+ <cores adminPath="/admin/cores">
16
+ <core name="core-01" instanceDir="testcore" dataDir="/tmp/multi-solr/data/core-01" />
17
+ <core name="core-02" instanceDir="testcore" dataDir="/tmp/multi-solr/data/core-02" />
18
+ </cores>
19
+ </solr>
20
+
@@ -0,0 +1,12 @@
1
+ <dataConfig>
2
+ <dataSource type="FileDataSource" encoding="UTF-8"/>
3
+ <document>
4
+ <entity name="page" processor="XPathEntityProcessor" stream="true" forEach="/artikel/"
5
+ url="articles.xml">
6
+ <field column="id" xpath="/artikel/id"/>
7
+ <field column="lager_id" xpath="/artikel/lager_id"/>
8
+ <field column="menge" xpath="/artikel/menge"/>
9
+ <field column="artikelnr" xpath="/artikel/artikelnr"/>
10
+ </entity>
11
+ </document>
12
+ </dataConfig>
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" ?>
2
+ <?xml-stylesheet type="text/xsl" href="solr_schema.xsl"?>
3
+
4
+ <schema name="COBRA Container-Contents R1.02" version="1.2">
5
+ <types>
6
+ <fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
7
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
8
+ <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
9
+ <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
10
+ <fieldType name="date" class="solr.TrieDateField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
11
+
12
+ <!-- A Trie based date field for faster date range queries and date faceting. -->
13
+ <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" omitNorms="true" positionIncrementGap="0"/>
14
+
15
+ <!-- boolean type: "true" or "false" -->
16
+ <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
17
+
18
+ <!-- A text field for Artikel-Bezeichnungen split into words and lowercase -->
19
+ <fieldType name="lc_text" class="solr.TextField" positionIncrementGap="100">
20
+ <analyzer>
21
+ <tokenizer class="solr.LowerCaseTokenizerFactory"/>
22
+ </analyzer>
23
+ </fieldType>
24
+ </types>
25
+
26
+ <fields>
27
+ <field name="id" type="int" indexed="true" stored="true" multiValued="false" required="true"/>
28
+ <field name="lager_id" type="int" indexed="true" stored="true" multiValued="false" />
29
+ <field name="menge" type="int" indexed="true" stored="true" multiValued="false" />
30
+ <field name="artikelnr" type="string" indexed="true" stored="true" multiValued="false" />
31
+ </fields>
32
+
33
+ <!-- field to use to determine and enforce document uniqueness. -->
34
+ <uniqueKey>id</uniqueKey>
35
+
36
+ <!-- field for the QueryParser to use when an explicit fieldname is absent -->
37
+ <defaultSearchField>artikelnr</defaultSearchField>
38
+
39
+ <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
40
+ <solrQueryParser defaultOperator="AND"/>
41
+ </schema>
42
+
@@ -0,0 +1,58 @@
1
+ h1 { margin: 0.1em 0 0 0; font-size: 18px; }
2
+ h2 { margin: 0; font-size: 14px; font-weight:normal; }
3
+
4
+ body, p, th, td {
5
+ font-size: 12px;
6
+ }
7
+
8
+ p.version {
9
+ margin-top:0.5em;
10
+ float: right;
11
+ }
12
+
13
+ div#fields {
14
+ float:left;
15
+ margin-right: 2em;
16
+ margin-top: 2em;
17
+ }
18
+
19
+ div#types {
20
+ float:left;
21
+ margin-top: 2em;
22
+ }
23
+
24
+ caption {
25
+ text-align: left;
26
+ font-size: 125%;
27
+ font-weight:bold;
28
+ padding-bottom: 0.2em;
29
+ }
30
+
31
+ table {
32
+ border-collapse:collapse;
33
+ }
34
+
35
+ thead th {
36
+ text-align: left;
37
+ font-weight:normal;
38
+ font-size: 10px;
39
+ padding: 3px 7px;
40
+ background-color:#d3d3d3;
41
+ border: 1px solid black;
42
+ }
43
+
44
+ td {
45
+ padding: 3px 7px;
46
+ border-bottom: 1px dotted gray;
47
+ }
48
+
49
+ .name {
50
+ font-size:120%;
51
+ font-weight: bold;
52
+ }
53
+ .property {
54
+ font-size: 85%;
55
+ }
56
+ div.false {
57
+ display:none;
58
+ }
@@ -0,0 +1,72 @@
1
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
+ <xsl:output method="html" encoding="utf-8"/>
3
+
4
+ <xsl:template match="/schema">
5
+ <html>
6
+ <head>
7
+ <title>Solr-Schema: <xsl:value-of select="@name"/></title>
8
+ <link rel="stylesheet" type="text/css" href="solr_schema.css"/>
9
+ </head>
10
+ <body>
11
+ <h2>Solr-Schema-Definition:</h2>
12
+ <h1>"<xsl:value-of select="@name"/>"</h1>
13
+ <div id="fields">
14
+ <xsl:apply-templates select="fields"/>
15
+ </div>
16
+ <div id="types">
17
+ <xsl:apply-templates select="types"/>
18
+ </div>
19
+ </body>
20
+ </html>
21
+ </xsl:template>
22
+
23
+ <xsl:template match="fields">
24
+ <table>
25
+ <caption>Fields</caption>
26
+ <thead>
27
+ <tr>
28
+ <th>Name</th>
29
+ <th>Type</th>
30
+ <th>Properties</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <xsl:for-each select="field">
35
+ <tr>
36
+ <td class="name"><xsl:value-of select="@name"/></td>
37
+ <td class="type"><xsl:value-of select="@type"/></td>
38
+ <td class="property">
39
+ <xsl:choose><xsl:when test="@indexed='true'">indexed </xsl:when></xsl:choose>
40
+ <xsl:choose><xsl:when test="@stored='true'">stored </xsl:when></xsl:choose>
41
+ <xsl:choose><xsl:when test="@multiValued='true'">multiValued </xsl:when></xsl:choose>
42
+ <xsl:choose><xsl:when test="@required='true'">required </xsl:when></xsl:choose>
43
+ </td>
44
+ </tr>
45
+ </xsl:for-each>
46
+ </tbody>
47
+ </table>
48
+ </xsl:template>
49
+
50
+
51
+ <xsl:template match="types">
52
+ <table>
53
+ <caption>Types</caption>
54
+ <thead>
55
+ <tr>
56
+ <th>Name</th>
57
+ <th>Class</th>
58
+ </tr>
59
+ </thead>
60
+ <tbody>
61
+ <xsl:for-each select="fieldType">
62
+ <tr>
63
+ <td class="name"><xsl:value-of select="@name"/></td>
64
+ <td class="type"><xsl:value-of select="@class"/></td>
65
+ </tr>
66
+ </xsl:for-each>
67
+ </tbody>
68
+ </table>
69
+ </xsl:template>
70
+
71
+ </xsl:stylesheet>
72
+
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+
4
+ <luceneMatchVersion>LUCENE_34</luceneMatchVersion>
5
+
6
+ <!-- Set this to 'false' if you want solr to continue working after it has
7
+ encountered an severe configuration error. In a production environment,
8
+ you may want solr to keep working even if one handler is mis-configured.
9
+
10
+ You may also set this to false using by setting the system property:
11
+ -Dsolr.abortOnConfigurationError=false
12
+ -->
13
+ <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
14
+
15
+ <indexDefaults>
16
+ <lockType>single</lockType>
17
+ </indexDefaults>
18
+
19
+
20
+ <updateHandler class="solr.DirectUpdateHandler2" />
21
+
22
+ <requestDispatcher handleSelect="true" >
23
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
24
+ </requestDispatcher>
25
+
26
+ <!-- SearchHandler
27
+
28
+ http://wiki.apache.org/solr/SearchHandler
29
+
30
+ For processing Search Queries, the primary Request Handler
31
+ provided with Solr is "SearchHandler" It delegates to a sequent
32
+ of SearchComponents (see below) and supports distributed
33
+ queries across multiple shards
34
+ -->
35
+ <requestHandler name="search" class="solr.SearchHandler" default="true">
36
+ <!-- default values for query parameters can be specified, these
37
+ will be overridden by parameters in the request
38
+ -->
39
+ <lst name="defaults">
40
+ <str name="echoParams">explicit</str>
41
+ <int name="rows">25</int>
42
+ </lst>
43
+ </requestHandler>
44
+
45
+ <!--<requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />-->
46
+ <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
47
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
48
+
49
+ <!-- ping/healthcheck -->
50
+ <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
51
+ <lst name="defaults">
52
+ <str name="qt">search</str>
53
+ <str name="q">solrpingquery</str>
54
+ <str name="echoParams">all</str>
55
+ </lst>
56
+ </requestHandler>
57
+
58
+ <requestHandler name="/dataimport-test" class="org.apache.solr.handler.dataimport.DataImportHandler">
59
+ <lst name="defaults">
60
+ <str name="config">dataimport-test.xml</str>
61
+ </lst>
62
+ </requestHandler>
63
+
64
+
65
+ <!-- config for the admin interface -->
66
+ <admin>
67
+ <defaultQuery>*:*</defaultQuery>
68
+ </admin>
69
+
70
+
71
+ </config>
72
+
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+
3
+ cd `dirname $0`
4
+ solr_dir=`pwd`
5
+ port=9983
6
+
7
+
8
+ cmd="java -Djetty.port=${port} -jar start.jar"
9
+ echo "Execute: ${cmd}"
10
+ ${cmd} 2> logs/solr-test-instance.log
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,212 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: multi-solr
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 5
10
+ version: 01.01.05
11
+ platform: ruby
12
+ authors:
13
+ - Bernd Ledig
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-05-07 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rsolr
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">"
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
33
+ version: "1.0"
34
+ - - <
35
+ - !ruby/object:Gem::Version
36
+ hash: 3
37
+ segments:
38
+ - 2
39
+ - 0
40
+ version: "2.0"
41
+ type: :runtime
42
+ version_requirements: *id001
43
+ - !ruby/object:Gem::Dependency
44
+ name: activesupport
45
+ prerelease: false
46
+ requirement: &id002 !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">"
50
+ - !ruby/object:Gem::Version
51
+ hash: 7
52
+ segments:
53
+ - 3
54
+ - 0
55
+ version: "3.0"
56
+ - - <
57
+ - !ruby/object:Gem::Version
58
+ hash: 27
59
+ segments:
60
+ - 4
61
+ - 0
62
+ version: "4.0"
63
+ type: :runtime
64
+ version_requirements: *id002
65
+ - !ruby/object:Gem::Dependency
66
+ name: i18n
67
+ prerelease: false
68
+ requirement: &id003 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :runtime
78
+ version_requirements: *id003
79
+ - !ruby/object:Gem::Dependency
80
+ name: rake
81
+ prerelease: false
82
+ requirement: &id004 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id004
93
+ - !ruby/object:Gem::Dependency
94
+ name: rspec
95
+ prerelease: false
96
+ requirement: &id005 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">"
100
+ - !ruby/object:Gem::Version
101
+ hash: 13
102
+ segments:
103
+ - 2
104
+ - 7
105
+ version: "2.7"
106
+ - - <
107
+ - !ruby/object:Gem::Version
108
+ hash: 7
109
+ segments:
110
+ - 3
111
+ - 0
112
+ version: "3.0"
113
+ type: :development
114
+ version_requirements: *id005
115
+ description: SOLR-Framework wit multi-core supoort and filters
116
+ email:
117
+ - bernd.ledig@ottogroup.com
118
+ executables: []
119
+
120
+ extensions: []
121
+
122
+ extra_rdoc_files: []
123
+
124
+ files:
125
+ - .gitignore
126
+ - .rspec
127
+ - Gemfile
128
+ - Rakefile
129
+ - lib/multi_solr.rb
130
+ - lib/multi_solr/base_searcher.rb
131
+ - lib/multi_solr/filter_value_composite.rb
132
+ - lib/multi_solr/rails_form_render_helper.rb
133
+ - lib/multi_solr/search_request.rb
134
+ - lib/multi_solr/search_result.rb
135
+ - lib/multi_solr/single_core_handler.rb
136
+ - lib/multi_solr/solr_filter_collection.rb
137
+ - lib/multi_solr/solr_filter_date.rb
138
+ - lib/multi_solr/solr_filter_date_range.rb
139
+ - lib/multi_solr/solr_filter_free_query.rb
140
+ - lib/multi_solr/solr_filter_simple.rb
141
+ - lib/multi_solr/timeline_core_handler.rb
142
+ - lib/multi_solr/version.rb
143
+ - multi-solr.gemspec
144
+ - spec/fixtures/solr-testdata.yml
145
+ - spec/multi_solr/base_searcher_spec.rb
146
+ - spec/multi_solr/search_request_spec.rb
147
+ - spec/multi_solr/search_result_spec.rb
148
+ - spec/multi_solr/single_core_handler_spec.rb
149
+ - spec/multi_solr/timeline_core_handler_spec.rb
150
+ - spec/solr_test_helper.rb
151
+ - spec/solr_testdata_provider.rb
152
+ - spec/spec_helper.rb
153
+ - test-solr/.gitignore
154
+ - test-solr/articles.xml
155
+ - test-solr/etc/jetty.xml
156
+ - test-solr/etc/webdefault.xml
157
+ - test-solr/lib/jetty-6.1.26-patched-JETTY-1340.jar
158
+ - test-solr/lib/jetty-LICENSE.txt
159
+ - test-solr/lib/jetty-NOTICE.txt
160
+ - test-solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar
161
+ - test-solr/lib/jsp-2.1/core-3.1.1.jar
162
+ - test-solr/lib/jsp-2.1/jsp-2.1-glassfish-2.1.v20091210.jar
163
+ - test-solr/lib/jsp-2.1/jsp-2.1-jetty-6.1.26.jar
164
+ - test-solr/lib/jsp-2.1/jsp-api-2.1-glassfish-2.1.v20091210.jar
165
+ - test-solr/lib/lukeall-3.4.0_1.jar
166
+ - test-solr/lib/servlet-api-2.5-20081211.jar
167
+ - test-solr/solr/lib/apache-solr-dataimporthandler-3.4.0.jar
168
+ - test-solr/solr/solr.xml
169
+ - test-solr/solr/testcore/conf/dataimport-test.xml
170
+ - test-solr/solr/testcore/conf/schema.xml
171
+ - test-solr/solr/testcore/conf/solr_schema.css
172
+ - test-solr/solr/testcore/conf/solr_schema.xsl
173
+ - test-solr/solr/testcore/conf/solrconfig.xml
174
+ - test-solr/start-test-solr.sh
175
+ - test-solr/start.jar
176
+ - test-solr/webapps/solr.war
177
+ has_rdoc: true
178
+ homepage: ""
179
+ licenses: []
180
+
181
+ post_install_message:
182
+ rdoc_options: []
183
+
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
194
+ version: "0"
195
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
+ none: false
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ hash: 3
201
+ segments:
202
+ - 0
203
+ version: "0"
204
+ requirements: []
205
+
206
+ rubyforge_project: multi-solr
207
+ rubygems_version: 1.6.2
208
+ signing_key:
209
+ specification_version: 3
210
+ summary: SOLR-Framework with support for multiple SOLR-Cores
211
+ test_files: []
212
+