erichummel-sunspot 1.2.1a
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/Gemfile.lock +32 -0
- data/History.txt +222 -0
- data/LICENSE +18 -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/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/adjustable.rb +47 -0
- data/lib/sunspot/dsl/field_query.rb +266 -0
- data/lib/sunspot/dsl/fields.rb +103 -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/restriction_with_near.rb +121 -0
- data/lib/sunspot/dsl/scope.rb +217 -0
- data/lib/sunspot/dsl/search.rb +30 -0
- data/lib/sunspot/dsl/standard_query.rb +121 -0
- data/lib/sunspot/dsl.rb +5 -0
- data/lib/sunspot/field.rb +193 -0
- data/lib/sunspot/field_factory.rb +129 -0
- data/lib/sunspot/indexer.rb +131 -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 +76 -0
- data/lib/sunspot/installer/task_helper.rb +18 -0
- data/lib/sunspot/installer.rb +31 -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 +36 -0
- data/lib/sunspot/query/connective.rb +206 -0
- data/lib/sunspot/query/date_field_facet.rb +14 -0
- data/lib/sunspot/query/dismax.rb +128 -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/geo.rb +53 -0
- data/lib/sunspot/query/highlighting.rb +55 -0
- data/lib/sunspot/query/more_like_this.rb +61 -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 +16 -0
- data/lib/sunspot/query/text_field_boost.rb +17 -0
- data/lib/sunspot/query.rb +11 -0
- data/lib/sunspot/schema.rb +151 -0
- data/lib/sunspot/search/abstract_search.rb +296 -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 +67 -0
- data/lib/sunspot/search/standard_search.rb +21 -0
- data/lib/sunspot/search.rb +9 -0
- data/lib/sunspot/server.rb +152 -0
- data/lib/sunspot/session.rb +260 -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 +222 -0
- data/lib/sunspot/session_proxy/silent_fail_session_proxy.rb +42 -0
- data/lib/sunspot/session_proxy/thread_local_session_proxy.rb +37 -0
- data/lib/sunspot/session_proxy.rb +87 -0
- data/lib/sunspot/setup.rb +350 -0
- data/lib/sunspot/text_field_setup.rb +29 -0
- data/lib/sunspot/type.rb +372 -0
- data/lib/sunspot/util.rb +243 -0
- data/lib/sunspot/version.rb +3 -0
- data/lib/sunspot.rb +569 -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 +238 -0
- data/solr/solr/conf/scripts.conf +24 -0
- data/solr/solr/conf/solrconfig.xml +934 -0
- data/solr/solr/conf/spellings.txt +2 -0
- data/solr/solr/conf/stopwords.txt +58 -0
- data/solr/solr/conf/synonyms.txt +31 -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 +50 -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 +189 -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/geo_examples.rb +69 -0
- data/spec/api/query/highlighting_examples.rb +225 -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 +275 -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 +360 -0
- data/spec/api/search/highlighting_spec.rb +69 -0
- data/spec/api/search/hits_spec.rb +140 -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/silent_fail_session_proxy_spec.rb +24 -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 +220 -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 +64 -0
- data/spec/integration/more_like_this_spec.rb +43 -0
- data/spec/integration/scoped_search_spec.rb +354 -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 +126 -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 +11 -0
- data/spec/mocks/post.rb +85 -0
- data/spec/mocks/super_class.rb +2 -0
- data/spec/mocks/user.rb +13 -0
- data/spec/spec_helper.rb +42 -0
- data/tasks/rdoc.rake +27 -0
- data/tasks/schema.rake +19 -0
- data/tasks/todo.rake +4 -0
- metadata +342 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sunspot (1.2.0)
|
5
|
+
escape (= 0.0.4)
|
6
|
+
pr_geohash (~> 1.0)
|
7
|
+
rsolr (= 0.12.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
builder (3.0.0)
|
13
|
+
columnize (0.3.2)
|
14
|
+
escape (0.0.4)
|
15
|
+
linecache (0.43)
|
16
|
+
pr_geohash (1.0.0)
|
17
|
+
rsolr (0.12.1)
|
18
|
+
builder (>= 2.1.2)
|
19
|
+
rspec (1.3.0)
|
20
|
+
ruby-debug (0.10.3)
|
21
|
+
columnize (>= 0.1)
|
22
|
+
ruby-debug-base (~> 0.10.3.0)
|
23
|
+
ruby-debug-base (0.10.3)
|
24
|
+
linecache (>= 0.3)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
rspec (~> 1.3)
|
31
|
+
ruby-debug
|
32
|
+
sunspot (= 1.2.0)!
|
data/History.txt
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
== 1.2.0 2010-12-28
|
2
|
+
* Replace solr-spatial-light with client-side geohash-based spatial search
|
3
|
+
* Override Solr field naming conventions using :as option
|
4
|
+
* Delegate #id method directly to calling context inside DSL
|
5
|
+
* Create a SilentFailSessionProxy that rescues exceptions on write operations.
|
6
|
+
* Inclusion by identity
|
7
|
+
* Solr optimize command
|
8
|
+
* Ignore negative :limit option for query facets
|
9
|
+
* Eliminated value sorting for range scopes
|
10
|
+
* Correctly cast stored boolean values if they are booleans
|
11
|
+
* Correctly cast and return stored values for multi-valued fields
|
12
|
+
|
13
|
+
== 1.1.0 2010-04-01
|
14
|
+
* MoreLikeThis support
|
15
|
+
* Allow multiple fulltext queries in one search
|
16
|
+
* Function queries
|
17
|
+
* Update solr-spatial-light to 0.0.6 build
|
18
|
+
* Support for :prefix when faceting.
|
19
|
+
* Allow specification of solr jar
|
20
|
+
* Updated reindex task to allow setting of batch size and list of models to index
|
21
|
+
* Use a '*:*' query for deleting the entire index
|
22
|
+
* Ability to specify custom request handler for queries
|
23
|
+
* Gracefully handle nonexistent search result
|
24
|
+
|
25
|
+
== 1.0.4 2010-03-19
|
26
|
+
* Update solr-spatial-light to 0.0.5
|
27
|
+
* Fix NullPointerException in repeated geo search
|
28
|
+
* Fix missing distances in repeated geo search
|
29
|
+
* Don't query the data store more than once when results are missing
|
30
|
+
|
31
|
+
== 1.0.2 2010-03-11
|
32
|
+
* Restore Hit#distance for result geo distance
|
33
|
+
* Remove :distance special sort
|
34
|
+
* Quote reserved keywords in boolean queries
|
35
|
+
* Add Search#facets accessor to retrieve all facets
|
36
|
+
|
37
|
+
== 1.0.1 2010-03-05
|
38
|
+
* Copy all needed config files when sunspot-installer run with force option
|
39
|
+
|
40
|
+
== 1.0.0 2010-03-03
|
41
|
+
* Multiselect Field Faceting
|
42
|
+
* Named field facets
|
43
|
+
* Upgrade to Solr 1.4
|
44
|
+
* Deletion by query
|
45
|
+
* Allow :latitude and :longitude as coordinate method names
|
46
|
+
* Assumed inconsistency
|
47
|
+
* Support for TrieField numeric/time types
|
48
|
+
* Built-in Session Proxies: Thread-local, master/slave, sharding
|
49
|
+
* Give DSL blocks access to calling context
|
50
|
+
* Create sunspot-installer executable, which modifies an existing
|
51
|
+
schema/solrconfig to work with Sunspot
|
52
|
+
* Support for Long and Double types
|
53
|
+
* new_search method accepts DSL block
|
54
|
+
* Sunspot::Server now a real class that manages embedded Sunspot instance
|
55
|
+
* Add Search#each_hit_with_result method
|
56
|
+
* Able to access stored dynamic fields
|
57
|
+
* Access dynamic facets using the #facet method
|
58
|
+
* Remove accidental existence of dynamic_text fields
|
59
|
+
* Upgrade to RSolr 0.12.1
|
60
|
+
* Switch from LocalSolr to solr-spatial-light
|
61
|
+
* Turn off request logging in Jetty for default Solr install
|
62
|
+
* Full support for class-reloading of Sunspot-setup classes
|
63
|
+
* Support time ranges outside of 32-bit range
|
64
|
+
* Remove sunspot-configure-solr executable
|
65
|
+
* new_search method accepts DSL block
|
66
|
+
|
67
|
+
== 0.10.8 2009-11-24
|
68
|
+
* Strictly enforce RSolr 0.9.6 gem dependency (newer ones broken)
|
69
|
+
|
70
|
+
== 0.10.7 2009-11-16
|
71
|
+
* Ignore boost_fields that don't apply
|
72
|
+
* Ability to specify text_fields inside connectives
|
73
|
+
* Fix bug with newlines in strings incorrectly being considered multi-value
|
74
|
+
* Compatibility with RSolr 0.10.1
|
75
|
+
* Remove commented-out code entirely
|
76
|
+
|
77
|
+
== 0.10.6 2009-11-05
|
78
|
+
* Support more dismax parameters
|
79
|
+
* Support multiple boost queries
|
80
|
+
* Allow "extra" facet rows
|
81
|
+
* Allow exclusion of fulltext fields
|
82
|
+
* Allow specification of per-field highlighting params
|
83
|
+
* Specify coordinates using block extraction
|
84
|
+
* Return empty array if no highlights available
|
85
|
+
* Get stored text fields from hits
|
86
|
+
* Update docs to reflect a requirement of at least one search type
|
87
|
+
* added --max-memory and --min-memory parameters to sunspot-solr
|
88
|
+
* LocalLucene and LocalSolr compatible with Java 1.5
|
89
|
+
|
90
|
+
== 0.10.5 2009-10-22
|
91
|
+
* Fix highlighting for multiple-model search
|
92
|
+
|
93
|
+
== 0.10.4 2009-10-20
|
94
|
+
* Add adjust_params method, allowing experts to manually edit Solr params
|
95
|
+
* Track adds and deletes separately in session, and expose delete_dirty? method
|
96
|
+
* Allow clients to inject a singleton session proxy
|
97
|
+
|
98
|
+
== 0.10.3 2009-10-15
|
99
|
+
* Contiguous, not continuous
|
100
|
+
* Fail fast if less-than-1 radius passed for local search
|
101
|
+
|
102
|
+
== 0.10.2 2009-10-09
|
103
|
+
* Add Sunspot.config.xml_builder option, which is passed to RSolr
|
104
|
+
|
105
|
+
== 0.10.1 2009-10-08
|
106
|
+
* Fix directory bugs in sunspot-solr executable
|
107
|
+
|
108
|
+
== 0.10.0 2009-10-08
|
109
|
+
* Support for geographical search using LocalSolr
|
110
|
+
* Support for keyword highlighting, with custom deferred formatting
|
111
|
+
* New fulltext DSL for specifying advanced dismax options
|
112
|
+
* Support boost queries
|
113
|
+
* Support for search-time field boost
|
114
|
+
* Support for phrase fields
|
115
|
+
* Support for prefix queries
|
116
|
+
* Set default search-time field boost in setup
|
117
|
+
* Restrict field facet to a set of desired values
|
118
|
+
* Query facets support all facet options
|
119
|
+
* Allow scoping by text fields
|
120
|
+
* Support executing searches repeatedly
|
121
|
+
* Allow setting of Solr URL for integration tests in environment variable
|
122
|
+
* Add support for master/slave configurations
|
123
|
+
* Added logging options to sunspot-solr executable
|
124
|
+
* Added default solr config file location to Sunspot::Configuration
|
125
|
+
* Informative, non-firehose Search#inspect
|
126
|
+
* No longer require arguments to #paginate
|
127
|
+
* Silently ignore keyword calls with nil/blank/whitespace keywords
|
128
|
+
* Don't require that all searched types have a referenced field
|
129
|
+
* Correct backwards ranges
|
130
|
+
* Raise descriptive error if no types passed to search
|
131
|
+
* Handle empty query facets, query facet rows, and connectives
|
132
|
+
* Quote values in range restrictions if they contain spaces
|
133
|
+
* Fix bug in Sunspot::Util.full_const_get
|
134
|
+
* Remove support for :other option in time faceting
|
135
|
+
* Remove order_by_random() method
|
136
|
+
* Removed options and Query from public API
|
137
|
+
* Use built-in optparse instead of optiflag in bin/sunspot-solr
|
138
|
+
* Remove dependency on haml and use erb since it is only used to generate one file
|
139
|
+
|
140
|
+
== 0.9.0 2009-07-21
|
141
|
+
* Use Dismax parser for keyword search
|
142
|
+
* Field and document boosting
|
143
|
+
* Specify which fields to search in keyword search
|
144
|
+
* Allow indexing of multiple values in text fields
|
145
|
+
* Access keyword relevance score in Hit objects
|
146
|
+
* Allow stored fields, retrieve stored values from Hit objects
|
147
|
+
* Support more values in shorthand restrictions
|
148
|
+
* Disjunctions and conjunctions
|
149
|
+
* Random ordering
|
150
|
+
* Control all options for field facets
|
151
|
+
* Time range facets
|
152
|
+
* Get referenced objects from facets on foreign keys
|
153
|
+
* Facet by class
|
154
|
+
* Batch indexing
|
155
|
+
* New Date field type
|
156
|
+
* Direct access to data accessors
|
157
|
+
* Executable to configure production Solr instances
|
158
|
+
* Replace solr-ruby with RSolr
|
159
|
+
* Remove accidental ActiveSupport dependency
|
160
|
+
|
161
|
+
== 0.8.9 2009-06-23
|
162
|
+
* Fix OrderedHash bug in older versions of ActiveSupport
|
163
|
+
|
164
|
+
== 0.8.8 2009-06-15
|
165
|
+
* Escape type names to support namespaced classes
|
166
|
+
* Fix bug with anonymous modules in Ruby 1.9
|
167
|
+
|
168
|
+
== 0.8.7 2009-06-10
|
169
|
+
* Add --pid-dir option for sunspot-solr executable
|
170
|
+
|
171
|
+
== 0.8.5 2009-06-09
|
172
|
+
* Added dependencies for sunspot-solr executable to gem dependencies
|
173
|
+
* Search for adapters using class ancestors rather than superclasses
|
174
|
+
|
175
|
+
== 0.8.3 2009-06-03
|
176
|
+
* Index objects passed as a collection in a single HTTP request
|
177
|
+
|
178
|
+
== 0.8.2 2009-05-27
|
179
|
+
* Allow specification of Solr home when using sunspot-solr
|
180
|
+
|
181
|
+
== 0.8.1 2009-05-26
|
182
|
+
* Add Search#execute! to public API
|
183
|
+
|
184
|
+
== 0.8.0 2009-05-22
|
185
|
+
* Access query API directly; instantiate search without running it
|
186
|
+
* Dynamic fields
|
187
|
+
* Search blocks can be evaluated in calling context
|
188
|
+
|
189
|
+
== 0.7.3 2009-05-06
|
190
|
+
* Better exception handling when class doesn't have adapter/setup
|
191
|
+
|
192
|
+
== 0.7.2 2009-04-29
|
193
|
+
* Dirty sessions
|
194
|
+
|
195
|
+
== 0.7.1 2009-04-29
|
196
|
+
* Removed extlib dependency from gemspec
|
197
|
+
|
198
|
+
== 0.7.0 2009-04-28
|
199
|
+
* Less magic in the DSL
|
200
|
+
* Restrict by empty values
|
201
|
+
* Negative scoping using without() method
|
202
|
+
* Exclusion by object identity using without(instance)
|
203
|
+
* Support for faceting
|
204
|
+
* Explicit commits
|
205
|
+
* Boolean field type
|
206
|
+
* Attribute field flexibility
|
207
|
+
* Virtual field blocks can be evaluated in calling context
|
208
|
+
* Order available by multiple fields
|
209
|
+
* New adapter API
|
210
|
+
* Got rid of builder API
|
211
|
+
* Full documentation
|
212
|
+
|
213
|
+
== 0.0.2 2009-02-14
|
214
|
+
* Run sunspot's built-in Solr instance using
|
215
|
+
sunspot-solr executable
|
216
|
+
* Search hash interpretation delegated to
|
217
|
+
Builder object
|
218
|
+
|
219
|
+
== 0.0.1 2008-12-11
|
220
|
+
* Initial release
|
221
|
+
* Define indexing for any class using DSL
|
222
|
+
* Search indexed classes using DSL
|
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
2
|
+
a copy of this software and associated documentation files (the
|
3
|
+
'Software'), to deal in the Software without restriction, including
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
7
|
+
the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be
|
10
|
+
included in all copies or substantial portions of the Software.
|
11
|
+
|
12
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
15
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
16
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
17
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
ENV['RUBYOPT'] = '-W1'
|
2
|
+
|
3
|
+
task :environment do
|
4
|
+
require File.dirname(__FILE__) + '/lib/sunspot'
|
5
|
+
end
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), 'lib', 'sunspot', 'version')
|
8
|
+
|
9
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
10
|
+
|
11
|
+
task :default => 'spec:api'
|
data/TODO
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
=== Sunspot 1.1.x ===
|
2
|
+
* commitWithin (needs support from RSolr, currently available in master)
|
3
|
+
* commit options (non-blocking, etc.)
|
4
|
+
|
5
|
+
=== Someday ===
|
6
|
+
* Shorthand arguments to Sunspot#search
|
7
|
+
* Rudimentary fulltext prefixing support
|
8
|
+
|
9
|
+
=== Solr 1.5 ===
|
10
|
+
* Field Collapsing (SOLR-236)
|
11
|
+
* Support for official spatial support (SOLR-773)
|
12
|
+
* Support sorting by function
|
13
|
+
* Support string constants in functions
|
data/VERSION.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'installer')
|
5
|
+
|
6
|
+
home = ARGV.select { |arg| arg !~ /^-/ }.last || Dir.pwd
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: sunspot-install [options] [solr-home]"
|
11
|
+
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
12
|
+
options[:verbose] = v
|
13
|
+
end
|
14
|
+
opts.on('-f', '--[no-]force', 'Overwrite schema and solrconfig files with Sunspot default, instead of modifying them (recommended for new Solr installation)') do |f|
|
15
|
+
options[:force] = f
|
16
|
+
end
|
17
|
+
end.parse!
|
18
|
+
|
19
|
+
Sunspot::Installer.execute(home, options)
|
data/bin/sunspot-solr
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
require 'fileutils'
|
4
|
+
require 'tempfile'
|
5
|
+
require 'tmpdir'
|
6
|
+
require 'optparse'
|
7
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'server')
|
8
|
+
rescue LoadError => e
|
9
|
+
if require 'rubygems'
|
10
|
+
retry
|
11
|
+
else
|
12
|
+
raise(e)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
server = Sunspot::Server.new
|
17
|
+
|
18
|
+
OptionParser.new do |opts|
|
19
|
+
opts.banner = "Usage: sunspot-solr start [options]"
|
20
|
+
|
21
|
+
opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
|
22
|
+
server.port = p
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on '-d', '--data-directory=DIRECTORY', 'Solr data directory' do |d|
|
26
|
+
server.solr_data_dir = File.expand_path(d)
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on '-s', '--solr-home=HOME', 'Solr home directory (should contain conf/ directory)' do |s|
|
30
|
+
server.solr_home = File.expand_path(s)
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on '-j', '--solr-jar=JAR', 'Solr start jar' do |j|
|
34
|
+
server.solr_jar = File.expand_path(j)
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on '--pid-dir=PID_DIR', 'Directory for pid files' do |pd|
|
38
|
+
server.pid_dir = File.expand_path(pd)
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on '-l', '--log-level=LOG_LEVEL', 'Solr logging level' do |l|
|
42
|
+
server.log_level = l
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on '--log-file=LOG_FILE', 'Path to Solr log file' do |lf|
|
46
|
+
server.log_file = File.expand_path(lf)
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on '--max-memory=MEMORY', 'Specify the maximum size of the memory allocation pool' do |mm|
|
50
|
+
server.max_memory = mm
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on '--min-memory=MEMORY', 'Specify the initial size of the memory allocation pool' do |mm|
|
54
|
+
server.min_memory = mm
|
55
|
+
end
|
56
|
+
end.parse!
|
57
|
+
|
58
|
+
begin
|
59
|
+
case ARGV[0]
|
60
|
+
when 'start'
|
61
|
+
server.start
|
62
|
+
when 'run'
|
63
|
+
server.run
|
64
|
+
when 'stop'
|
65
|
+
server.stop
|
66
|
+
when 'restart'
|
67
|
+
server.stop
|
68
|
+
server.start
|
69
|
+
else
|
70
|
+
abort("Usage: sunspot-solr (start|stop|run)")
|
71
|
+
end
|
72
|
+
rescue Sunspot::Server::ServerError => e
|
73
|
+
abort(e.message)
|
74
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
types: !omap
|
2
|
+
- text:
|
3
|
+
class: TextField
|
4
|
+
suffix: text
|
5
|
+
omit_norms: false
|
6
|
+
tokenizer: StandardTokenizerFactory
|
7
|
+
filters:
|
8
|
+
- StandardFilterFactory
|
9
|
+
- LowerCaseFilterFactory
|
10
|
+
invariants:
|
11
|
+
multiValued: true
|
12
|
+
- boolean:
|
13
|
+
class: BoolField
|
14
|
+
suffix: b
|
15
|
+
invariants:
|
16
|
+
termVectors: valse
|
17
|
+
- date:
|
18
|
+
class: DateField
|
19
|
+
suffix: d
|
20
|
+
invariants:
|
21
|
+
termVectors: valse
|
22
|
+
- rand:
|
23
|
+
class: RandomSortField
|
24
|
+
- sdouble:
|
25
|
+
class: SortableDoubleField
|
26
|
+
suffix: e
|
27
|
+
invariants:
|
28
|
+
termVectors: valse
|
29
|
+
- sfloat:
|
30
|
+
class: SortableFloatField
|
31
|
+
suffix: f
|
32
|
+
invariants:
|
33
|
+
termVectors: valse
|
34
|
+
- sint:
|
35
|
+
class: SortableIntField
|
36
|
+
suffix: i
|
37
|
+
invariants:
|
38
|
+
termVectors: valse
|
39
|
+
- slong:
|
40
|
+
class: SortableLongField
|
41
|
+
suffix: l
|
42
|
+
invariants:
|
43
|
+
termVectors: valse
|
44
|
+
- string:
|
45
|
+
class: StrField
|
46
|
+
suffix: s
|
47
|
+
invariants:
|
48
|
+
termVectors: valse
|
49
|
+
- tint:
|
50
|
+
class: TrieIntField
|
51
|
+
suffix: it
|
52
|
+
invariants:
|
53
|
+
termVectors: valse
|
54
|
+
- tfloat:
|
55
|
+
class: TrieFloatField
|
56
|
+
suffix: ft
|
57
|
+
invariants:
|
58
|
+
termVectors: valse
|
59
|
+
- tdouble:
|
60
|
+
class: TrieDoubleField
|
61
|
+
suffix: et
|
62
|
+
invariants:
|
63
|
+
termVectors: valse
|
64
|
+
- tdate:
|
65
|
+
class: TrieDateField
|
66
|
+
suffix: dt
|
67
|
+
invariants:
|
68
|
+
termVectors: valse
|
69
|
+
fixed: !omap
|
70
|
+
- id:
|
71
|
+
type: string
|
72
|
+
attributes: [stored]
|
73
|
+
- type:
|
74
|
+
type: string
|
75
|
+
attributes: [multiValued]
|
76
|
+
- class_name:
|
77
|
+
type: string
|
78
|
+
- text:
|
79
|
+
type: string
|
80
|
+
attributes: [multiValued]
|
81
|
+
- lat:
|
82
|
+
type: tdouble
|
83
|
+
attributes: [stored]
|
84
|
+
- lng:
|
85
|
+
type: tdouble
|
86
|
+
attributes: [stored]
|
87
|
+
- 'random_*':
|
88
|
+
type: rand
|
89
|
+
- '_local*':
|
90
|
+
type: tdouble
|
91
|
+
|
92
|
+
variants: !omap
|
93
|
+
- multiValued: m
|
94
|
+
- stored: s
|
95
|
+
- termVectors: v
|
data/lib/light_config.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module LightConfig
|
2
|
+
class Configuration
|
3
|
+
def initialize(&block)
|
4
|
+
@properties = {}
|
5
|
+
::LightConfig::Builder.new(self).instance_eval(&block)
|
6
|
+
singleton = (class <<self; self; end)
|
7
|
+
@properties.keys.each do |property|
|
8
|
+
singleton.module_eval do
|
9
|
+
define_method property do
|
10
|
+
@properties[property]
|
11
|
+
end
|
12
|
+
|
13
|
+
define_method "#{property}=" do |value|
|
14
|
+
@properties[property] = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Builder
|
22
|
+
def initialize(configuration)
|
23
|
+
@configuration = configuration
|
24
|
+
end
|
25
|
+
|
26
|
+
def method_missing(method, *args, &block)
|
27
|
+
raise ArgumentError("wrong number of arguments(#{args.length} for 1)") unless args.length < 2
|
28
|
+
value = if block then ::LightConfig::Configuration.new(&block)
|
29
|
+
else args.first
|
30
|
+
end
|
31
|
+
@configuration.instance_variable_get(:@properties)[method] = value
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class <<self
|
36
|
+
def build(&block)
|
37
|
+
LightConfig::Configuration.new(&block)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|