pduey-sunspot 1.2.1.1

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 (166) hide show
  1. data/.gitignore +12 -0
  2. data/Gemfile +5 -0
  3. data/History.txt +225 -0
  4. data/LICENSE +18 -0
  5. data/Rakefile +15 -0
  6. data/TODO +13 -0
  7. data/VERSION.yml +4 -0
  8. data/bin/sunspot-installer +19 -0
  9. data/installer/config/schema.yml +95 -0
  10. data/lib/light_config.rb +40 -0
  11. data/lib/sunspot.rb +568 -0
  12. data/lib/sunspot/adapters.rb +265 -0
  13. data/lib/sunspot/composite_setup.rb +202 -0
  14. data/lib/sunspot/configuration.rb +46 -0
  15. data/lib/sunspot/data_extractor.rb +50 -0
  16. data/lib/sunspot/dsl.rb +5 -0
  17. data/lib/sunspot/dsl/adjustable.rb +47 -0
  18. data/lib/sunspot/dsl/field_query.rb +279 -0
  19. data/lib/sunspot/dsl/fields.rb +103 -0
  20. data/lib/sunspot/dsl/fulltext.rb +243 -0
  21. data/lib/sunspot/dsl/function.rb +14 -0
  22. data/lib/sunspot/dsl/functional.rb +44 -0
  23. data/lib/sunspot/dsl/more_like_this_query.rb +56 -0
  24. data/lib/sunspot/dsl/paginatable.rb +28 -0
  25. data/lib/sunspot/dsl/query_facet.rb +36 -0
  26. data/lib/sunspot/dsl/restriction.rb +25 -0
  27. data/lib/sunspot/dsl/restriction_with_near.rb +121 -0
  28. data/lib/sunspot/dsl/scope.rb +217 -0
  29. data/lib/sunspot/dsl/search.rb +30 -0
  30. data/lib/sunspot/dsl/standard_query.rb +121 -0
  31. data/lib/sunspot/field.rb +193 -0
  32. data/lib/sunspot/field_factory.rb +129 -0
  33. data/lib/sunspot/indexer.rb +131 -0
  34. data/lib/sunspot/installer.rb +31 -0
  35. data/lib/sunspot/installer/library_installer.rb +45 -0
  36. data/lib/sunspot/installer/schema_builder.rb +219 -0
  37. data/lib/sunspot/installer/solrconfig_updater.rb +76 -0
  38. data/lib/sunspot/installer/task_helper.rb +18 -0
  39. data/lib/sunspot/java.rb +8 -0
  40. data/lib/sunspot/query.rb +11 -0
  41. data/lib/sunspot/query/abstract_field_facet.rb +52 -0
  42. data/lib/sunspot/query/boost_query.rb +24 -0
  43. data/lib/sunspot/query/common_query.rb +85 -0
  44. data/lib/sunspot/query/composite_fulltext.rb +36 -0
  45. data/lib/sunspot/query/connective.rb +206 -0
  46. data/lib/sunspot/query/date_field_facet.rb +14 -0
  47. data/lib/sunspot/query/dismax.rb +128 -0
  48. data/lib/sunspot/query/field_facet.rb +41 -0
  49. data/lib/sunspot/query/filter.rb +38 -0
  50. data/lib/sunspot/query/function_query.rb +52 -0
  51. data/lib/sunspot/query/geo.rb +53 -0
  52. data/lib/sunspot/query/highlighting.rb +55 -0
  53. data/lib/sunspot/query/more_like_this.rb +61 -0
  54. data/lib/sunspot/query/more_like_this_query.rb +12 -0
  55. data/lib/sunspot/query/pagination.rb +38 -0
  56. data/lib/sunspot/query/query_facet.rb +16 -0
  57. data/lib/sunspot/query/restriction.rb +262 -0
  58. data/lib/sunspot/query/scope.rb +9 -0
  59. data/lib/sunspot/query/sort.rb +95 -0
  60. data/lib/sunspot/query/sort_composite.rb +33 -0
  61. data/lib/sunspot/query/standard_query.rb +16 -0
  62. data/lib/sunspot/query/text_field_boost.rb +17 -0
  63. data/lib/sunspot/schema.rb +151 -0
  64. data/lib/sunspot/search.rb +9 -0
  65. data/lib/sunspot/search/abstract_search.rb +335 -0
  66. data/lib/sunspot/search/date_facet.rb +35 -0
  67. data/lib/sunspot/search/facet_row.rb +27 -0
  68. data/lib/sunspot/search/field_facet.rb +88 -0
  69. data/lib/sunspot/search/highlight.rb +38 -0
  70. data/lib/sunspot/search/hit.rb +150 -0
  71. data/lib/sunspot/search/more_like_this_search.rb +31 -0
  72. data/lib/sunspot/search/paginated_collection.rb +55 -0
  73. data/lib/sunspot/search/query_facet.rb +67 -0
  74. data/lib/sunspot/search/standard_search.rb +21 -0
  75. data/lib/sunspot/session.rb +260 -0
  76. data/lib/sunspot/session_proxy.rb +87 -0
  77. data/lib/sunspot/session_proxy/abstract_session_proxy.rb +29 -0
  78. data/lib/sunspot/session_proxy/class_sharding_session_proxy.rb +66 -0
  79. data/lib/sunspot/session_proxy/id_sharding_session_proxy.rb +89 -0
  80. data/lib/sunspot/session_proxy/master_slave_session_proxy.rb +43 -0
  81. data/lib/sunspot/session_proxy/sharding_session_proxy.rb +222 -0
  82. data/lib/sunspot/session_proxy/silent_fail_session_proxy.rb +42 -0
  83. data/lib/sunspot/session_proxy/thread_local_session_proxy.rb +37 -0
  84. data/lib/sunspot/setup.rb +350 -0
  85. data/lib/sunspot/text_field_setup.rb +29 -0
  86. data/lib/sunspot/type.rb +372 -0
  87. data/lib/sunspot/util.rb +243 -0
  88. data/lib/sunspot/version.rb +3 -0
  89. data/pduey-sunspot.gemspec +38 -0
  90. data/script/console +10 -0
  91. data/spec/api/adapters_spec.rb +33 -0
  92. data/spec/api/binding_spec.rb +50 -0
  93. data/spec/api/indexer/attributes_spec.rb +149 -0
  94. data/spec/api/indexer/batch_spec.rb +46 -0
  95. data/spec/api/indexer/dynamic_fields_spec.rb +42 -0
  96. data/spec/api/indexer/fixed_fields_spec.rb +57 -0
  97. data/spec/api/indexer/fulltext_spec.rb +43 -0
  98. data/spec/api/indexer/removal_spec.rb +53 -0
  99. data/spec/api/indexer/spec_helper.rb +1 -0
  100. data/spec/api/indexer_spec.rb +14 -0
  101. data/spec/api/query/advanced_manipulation_examples.rb +35 -0
  102. data/spec/api/query/connectives_examples.rb +189 -0
  103. data/spec/api/query/dsl_spec.rb +18 -0
  104. data/spec/api/query/dynamic_fields_examples.rb +165 -0
  105. data/spec/api/query/faceting_examples.rb +397 -0
  106. data/spec/api/query/fulltext_examples.rb +313 -0
  107. data/spec/api/query/function_spec.rb +70 -0
  108. data/spec/api/query/geo_examples.rb +68 -0
  109. data/spec/api/query/highlighting_examples.rb +223 -0
  110. data/spec/api/query/more_like_this_spec.rb +140 -0
  111. data/spec/api/query/ordering_pagination_examples.rb +95 -0
  112. data/spec/api/query/scope_examples.rb +275 -0
  113. data/spec/api/query/spec_helper.rb +1 -0
  114. data/spec/api/query/standard_spec.rb +28 -0
  115. data/spec/api/query/text_field_scoping_examples.rb +30 -0
  116. data/spec/api/query/types_spec.rb +20 -0
  117. data/spec/api/search/dynamic_fields_spec.rb +33 -0
  118. data/spec/api/search/faceting_spec.rb +360 -0
  119. data/spec/api/search/highlighting_spec.rb +69 -0
  120. data/spec/api/search/hits_spec.rb +131 -0
  121. data/spec/api/search/paginated_collection_spec.rb +26 -0
  122. data/spec/api/search/results_spec.rb +66 -0
  123. data/spec/api/search/search_spec.rb +23 -0
  124. data/spec/api/search/spec_helper.rb +1 -0
  125. data/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +85 -0
  126. data/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +30 -0
  127. data/spec/api/session_proxy/master_slave_session_proxy_spec.rb +41 -0
  128. data/spec/api/session_proxy/sharding_session_proxy_spec.rb +77 -0
  129. data/spec/api/session_proxy/silent_fail_session_proxy_spec.rb +24 -0
  130. data/spec/api/session_proxy/spec_helper.rb +9 -0
  131. data/spec/api/session_proxy/thread_local_session_proxy_spec.rb +39 -0
  132. data/spec/api/session_spec.rb +220 -0
  133. data/spec/api/spec_helper.rb +3 -0
  134. data/spec/api/sunspot_spec.rb +18 -0
  135. data/spec/ext.rb +11 -0
  136. data/spec/helpers/indexer_helper.rb +29 -0
  137. data/spec/helpers/query_helper.rb +38 -0
  138. data/spec/helpers/search_helper.rb +80 -0
  139. data/spec/integration/dynamic_fields_spec.rb +57 -0
  140. data/spec/integration/faceting_spec.rb +238 -0
  141. data/spec/integration/highlighting_spec.rb +24 -0
  142. data/spec/integration/indexing_spec.rb +33 -0
  143. data/spec/integration/keyword_search_spec.rb +317 -0
  144. data/spec/integration/local_search_spec.rb +64 -0
  145. data/spec/integration/more_like_this_spec.rb +43 -0
  146. data/spec/integration/scoped_search_spec.rb +354 -0
  147. data/spec/integration/spec_helper.rb +7 -0
  148. data/spec/integration/stored_fields_spec.rb +12 -0
  149. data/spec/integration/test_pagination.rb +32 -0
  150. data/spec/mocks/adapters.rb +32 -0
  151. data/spec/mocks/blog.rb +3 -0
  152. data/spec/mocks/comment.rb +21 -0
  153. data/spec/mocks/connection.rb +126 -0
  154. data/spec/mocks/mock_adapter.rb +30 -0
  155. data/spec/mocks/mock_class_sharding_session_proxy.rb +24 -0
  156. data/spec/mocks/mock_record.rb +52 -0
  157. data/spec/mocks/mock_sharding_session_proxy.rb +15 -0
  158. data/spec/mocks/photo.rb +11 -0
  159. data/spec/mocks/post.rb +85 -0
  160. data/spec/mocks/super_class.rb +2 -0
  161. data/spec/mocks/user.rb +13 -0
  162. data/spec/spec_helper.rb +28 -0
  163. data/tasks/rdoc.rake +27 -0
  164. data/tasks/schema.rake +19 -0
  165. data/tasks/todo.rake +4 -0
  166. metadata +369 -0
@@ -0,0 +1,12 @@
1
+ sunspot-solr.pid
2
+ *.swp
3
+ coverage
4
+ pkg
5
+ /doc
6
+ .DS_Store
7
+
8
+ .yardoc
9
+ sunspot.gemspec
10
+ README.rdoc
11
+ .bundle
12
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'sunspot_solr', :path => File.expand_path('../../sunspot_solr', __FILE__)
4
+
5
+ gemspec
@@ -0,0 +1,225 @@
1
+ == 1.2.1 2010-12-28
2
+ * Decreased default reindexing batch size from 500 to 50
3
+
4
+ == 1.2.0 2010-12-28
5
+ * Replace solr-spatial-light with client-side geohash-based spatial search
6
+ * Override Solr field naming conventions using :as option
7
+ * Delegate #id method directly to calling context inside DSL
8
+ * Create a SilentFailSessionProxy that rescues exceptions on write operations.
9
+ * Inclusion by identity
10
+ * Solr optimize command
11
+ * Ignore negative :limit option for query facets
12
+ * Eliminated value sorting for range scopes
13
+ * Correctly cast stored boolean values if they are booleans
14
+ * Correctly cast and return stored values for multi-valued fields
15
+
16
+ == 1.1.0 2010-04-01
17
+ * MoreLikeThis support
18
+ * Allow multiple fulltext queries in one search
19
+ * Function queries
20
+ * Update solr-spatial-light to 0.0.6 build
21
+ * Support for :prefix when faceting.
22
+ * Allow specification of solr jar
23
+ * Updated reindex task to allow setting of batch size and list of models to index
24
+ * Use a '*:*' query for deleting the entire index
25
+ * Ability to specify custom request handler for queries
26
+ * Gracefully handle nonexistent search result
27
+
28
+ == 1.0.4 2010-03-19
29
+ * Update solr-spatial-light to 0.0.5
30
+ * Fix NullPointerException in repeated geo search
31
+ * Fix missing distances in repeated geo search
32
+ * Don't query the data store more than once when results are missing
33
+
34
+ == 1.0.2 2010-03-11
35
+ * Restore Hit#distance for result geo distance
36
+ * Remove :distance special sort
37
+ * Quote reserved keywords in boolean queries
38
+ * Add Search#facets accessor to retrieve all facets
39
+
40
+ == 1.0.1 2010-03-05
41
+ * Copy all needed config files when sunspot-installer run with force option
42
+
43
+ == 1.0.0 2010-03-03
44
+ * Multiselect Field Faceting
45
+ * Named field facets
46
+ * Upgrade to Solr 1.4
47
+ * Deletion by query
48
+ * Allow :latitude and :longitude as coordinate method names
49
+ * Assumed inconsistency
50
+ * Support for TrieField numeric/time types
51
+ * Built-in Session Proxies: Thread-local, master/slave, sharding
52
+ * Give DSL blocks access to calling context
53
+ * Create sunspot-installer executable, which modifies an existing
54
+ schema/solrconfig to work with Sunspot
55
+ * Support for Long and Double types
56
+ * new_search method accepts DSL block
57
+ * Sunspot::Server now a real class that manages embedded Sunspot instance
58
+ * Add Search#each_hit_with_result method
59
+ * Able to access stored dynamic fields
60
+ * Access dynamic facets using the #facet method
61
+ * Remove accidental existence of dynamic_text fields
62
+ * Upgrade to RSolr 0.12.1
63
+ * Switch from LocalSolr to solr-spatial-light
64
+ * Turn off request logging in Jetty for default Solr install
65
+ * Full support for class-reloading of Sunspot-setup classes
66
+ * Support time ranges outside of 32-bit range
67
+ * Remove sunspot-configure-solr executable
68
+ * new_search method accepts DSL block
69
+
70
+ == 0.10.8 2009-11-24
71
+ * Strictly enforce RSolr 0.9.6 gem dependency (newer ones broken)
72
+
73
+ == 0.10.7 2009-11-16
74
+ * Ignore boost_fields that don't apply
75
+ * Ability to specify text_fields inside connectives
76
+ * Fix bug with newlines in strings incorrectly being considered multi-value
77
+ * Compatibility with RSolr 0.10.1
78
+ * Remove commented-out code entirely
79
+
80
+ == 0.10.6 2009-11-05
81
+ * Support more dismax parameters
82
+ * Support multiple boost queries
83
+ * Allow "extra" facet rows
84
+ * Allow exclusion of fulltext fields
85
+ * Allow specification of per-field highlighting params
86
+ * Specify coordinates using block extraction
87
+ * Return empty array if no highlights available
88
+ * Get stored text fields from hits
89
+ * Update docs to reflect a requirement of at least one search type
90
+ * added --max-memory and --min-memory parameters to sunspot-solr
91
+ * LocalLucene and LocalSolr compatible with Java 1.5
92
+
93
+ == 0.10.5 2009-10-22
94
+ * Fix highlighting for multiple-model search
95
+
96
+ == 0.10.4 2009-10-20
97
+ * Add adjust_params method, allowing experts to manually edit Solr params
98
+ * Track adds and deletes separately in session, and expose delete_dirty? method
99
+ * Allow clients to inject a singleton session proxy
100
+
101
+ == 0.10.3 2009-10-15
102
+ * Contiguous, not continuous
103
+ * Fail fast if less-than-1 radius passed for local search
104
+
105
+ == 0.10.2 2009-10-09
106
+ * Add Sunspot.config.xml_builder option, which is passed to RSolr
107
+
108
+ == 0.10.1 2009-10-08
109
+ * Fix directory bugs in sunspot-solr executable
110
+
111
+ == 0.10.0 2009-10-08
112
+ * Support for geographical search using LocalSolr
113
+ * Support for keyword highlighting, with custom deferred formatting
114
+ * New fulltext DSL for specifying advanced dismax options
115
+ * Support boost queries
116
+ * Support for search-time field boost
117
+ * Support for phrase fields
118
+ * Support for prefix queries
119
+ * Set default search-time field boost in setup
120
+ * Restrict field facet to a set of desired values
121
+ * Query facets support all facet options
122
+ * Allow scoping by text fields
123
+ * Support executing searches repeatedly
124
+ * Allow setting of Solr URL for integration tests in environment variable
125
+ * Add support for master/slave configurations
126
+ * Added logging options to sunspot-solr executable
127
+ * Added default solr config file location to Sunspot::Configuration
128
+ * Informative, non-firehose Search#inspect
129
+ * No longer require arguments to #paginate
130
+ * Silently ignore keyword calls with nil/blank/whitespace keywords
131
+ * Don't require that all searched types have a referenced field
132
+ * Correct backwards ranges
133
+ * Raise descriptive error if no types passed to search
134
+ * Handle empty query facets, query facet rows, and connectives
135
+ * Quote values in range restrictions if they contain spaces
136
+ * Fix bug in Sunspot::Util.full_const_get
137
+ * Remove support for :other option in time faceting
138
+ * Remove order_by_random() method
139
+ * Removed options and Query from public API
140
+ * Use built-in optparse instead of optiflag in bin/sunspot-solr
141
+ * Remove dependency on haml and use erb since it is only used to generate one file
142
+
143
+ == 0.9.0 2009-07-21
144
+ * Use Dismax parser for keyword search
145
+ * Field and document boosting
146
+ * Specify which fields to search in keyword search
147
+ * Allow indexing of multiple values in text fields
148
+ * Access keyword relevance score in Hit objects
149
+ * Allow stored fields, retrieve stored values from Hit objects
150
+ * Support more values in shorthand restrictions
151
+ * Disjunctions and conjunctions
152
+ * Random ordering
153
+ * Control all options for field facets
154
+ * Time range facets
155
+ * Get referenced objects from facets on foreign keys
156
+ * Facet by class
157
+ * Batch indexing
158
+ * New Date field type
159
+ * Direct access to data accessors
160
+ * Executable to configure production Solr instances
161
+ * Replace solr-ruby with RSolr
162
+ * Remove accidental ActiveSupport dependency
163
+
164
+ == 0.8.9 2009-06-23
165
+ * Fix OrderedHash bug in older versions of ActiveSupport
166
+
167
+ == 0.8.8 2009-06-15
168
+ * Escape type names to support namespaced classes
169
+ * Fix bug with anonymous modules in Ruby 1.9
170
+
171
+ == 0.8.7 2009-06-10
172
+ * Add --pid-dir option for sunspot-solr executable
173
+
174
+ == 0.8.5 2009-06-09
175
+ * Added dependencies for sunspot-solr executable to gem dependencies
176
+ * Search for adapters using class ancestors rather than superclasses
177
+
178
+ == 0.8.3 2009-06-03
179
+ * Index objects passed as a collection in a single HTTP request
180
+
181
+ == 0.8.2 2009-05-27
182
+ * Allow specification of Solr home when using sunspot-solr
183
+
184
+ == 0.8.1 2009-05-26
185
+ * Add Search#execute! to public API
186
+
187
+ == 0.8.0 2009-05-22
188
+ * Access query API directly; instantiate search without running it
189
+ * Dynamic fields
190
+ * Search blocks can be evaluated in calling context
191
+
192
+ == 0.7.3 2009-05-06
193
+ * Better exception handling when class doesn't have adapter/setup
194
+
195
+ == 0.7.2 2009-04-29
196
+ * Dirty sessions
197
+
198
+ == 0.7.1 2009-04-29
199
+ * Removed extlib dependency from gemspec
200
+
201
+ == 0.7.0 2009-04-28
202
+ * Less magic in the DSL
203
+ * Restrict by empty values
204
+ * Negative scoping using without() method
205
+ * Exclusion by object identity using without(instance)
206
+ * Support for faceting
207
+ * Explicit commits
208
+ * Boolean field type
209
+ * Attribute field flexibility
210
+ * Virtual field blocks can be evaluated in calling context
211
+ * Order available by multiple fields
212
+ * New adapter API
213
+ * Got rid of builder API
214
+ * Full documentation
215
+
216
+ == 0.0.2 2009-02-14
217
+ * Run sunspot's built-in Solr instance using
218
+ sunspot-solr executable
219
+ * Search hash interpretation delegated to
220
+ Builder object
221
+
222
+ == 0.0.1 2008-12-11
223
+ * Initial release
224
+ * Define indexing for any class using DSL
225
+ * 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.
@@ -0,0 +1,15 @@
1
+ ENV['RUBYOPT'] = '-W1'
2
+
3
+ # encoding: UTF-8
4
+
5
+ require 'spec/rake/spectask'
6
+
7
+ Dir['tasks/**/*.rake'].each { |t| load t }
8
+
9
+ desc "Run all examples"
10
+ Spec::Rake::SpecTask.new(:spec) do |t|
11
+ t.spec_files = Dir.glob('spec/**/*_spec.rb')
12
+ t.spec_opts << '--format specdoc'
13
+ end
14
+
15
+ task :default => 'spec'
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
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 10
3
+ :patch: 8
4
+ :major: 0
@@ -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)
@@ -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
@@ -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