rsolr 0.12.0 → 2.6.0

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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +29 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +2 -0
  5. data/CHANGES.txt +63 -260
  6. data/Gemfile +13 -0
  7. data/README.rdoc +177 -63
  8. data/Rakefile +19 -0
  9. data/lib/rsolr/char.rb +6 -0
  10. data/lib/rsolr/client.rb +344 -86
  11. data/lib/rsolr/document.rb +66 -0
  12. data/lib/rsolr/error.rb +182 -0
  13. data/lib/rsolr/field.rb +87 -0
  14. data/lib/rsolr/generator.rb +5 -0
  15. data/lib/rsolr/json.rb +60 -0
  16. data/lib/rsolr/response.rb +95 -0
  17. data/lib/rsolr/uri.rb +25 -0
  18. data/lib/rsolr/version.rb +7 -0
  19. data/lib/rsolr/xml.rb +150 -0
  20. data/lib/rsolr.rb +47 -35
  21. data/rsolr.gemspec +44 -31
  22. data/spec/api/client_spec.rb +423 -0
  23. data/spec/api/document_spec.rb +48 -0
  24. data/spec/api/error_spec.rb +158 -0
  25. data/spec/api/json_spec.rb +248 -0
  26. data/spec/api/pagination_spec.rb +31 -0
  27. data/spec/api/rsolr_spec.rb +31 -0
  28. data/spec/api/uri_spec.rb +37 -0
  29. data/spec/api/xml_spec.rb +255 -0
  30. data/spec/fixtures/basic_configs/_rest_managed.json +1 -0
  31. data/spec/fixtures/basic_configs/currency.xml +67 -0
  32. data/spec/fixtures/basic_configs/lang/stopwords_en.txt +54 -0
  33. data/spec/fixtures/basic_configs/protwords.txt +21 -0
  34. data/spec/fixtures/basic_configs/schema.xml +530 -0
  35. data/spec/fixtures/basic_configs/solrconfig.xml +572 -0
  36. data/spec/fixtures/basic_configs/stopwords.txt +14 -0
  37. data/spec/fixtures/basic_configs/synonyms.txt +29 -0
  38. data/spec/integration/solr5_spec.rb +38 -0
  39. data/spec/lib/rsolr/client_spec.rb +19 -0
  40. data/spec/spec_helper.rb +94 -0
  41. metadata +228 -54
  42. data/lib/rsolr/connection/net_http.rb +0 -48
  43. data/lib/rsolr/connection/requestable.rb +0 -43
  44. data/lib/rsolr/connection/utils.rb +0 -73
  45. data/lib/rsolr/connection.rb +0 -9
  46. data/lib/rsolr/message/document.rb +0 -48
  47. data/lib/rsolr/message/field.rb +0 -20
  48. data/lib/rsolr/message/generator.rb +0 -89
  49. data/lib/rsolr/message.rb +0 -8
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2b7e170dd7fcd0bfd504562297b93a6fb504da5e95df0d356cd0d1c70a7515c8
4
+ data.tar.gz: b4d04a24455588c421f72d29b8e9e7ab255fb4bfde9457bc6ab5f64bb64c76a4
5
+ SHA512:
6
+ metadata.gz: cd27dcd3369b5d1e4cd99604426927bf83a3a4c3ef7d8a06fb3cfc45676b33c920ce256ecb7fc577dedbbe910b6d50a45fdaa7dd0324516529c5705df8698385
7
+ data.tar.gz: 5a488c3aa5e5ca93e8fe2647baf313d8b5a94229e99d6a49820a3bf80b65fe9c19fd8ab05678ee402d3674d7a043ded6110acdf4ada5a2a1752b96f4080ceec1
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ tests:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby: [jruby-9.3.3.0, '3.0', '3.1', '3.2', '3.3']
15
+ faraday: ['~> 0.17', '~> 1', '~>2']
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ env:
25
+ FARADAY_VERSION: ${{ matrix.faraday}}
26
+ - name: Run tests
27
+ run: bundle exec rake
28
+ env:
29
+ FARADAY_VERSION: ${{ matrix.faraday}}
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ .DS_Store
2
+ .yardoc/
3
+ pkg/*
4
+ apache-solr-3.3.0/
5
+ coverage/
6
+ doc/
7
+ example/
8
+
9
+ Gemfile.lock
10
+
11
+ *.gem
12
+ .bundle
13
+ /spec/examples.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/CHANGES.txt CHANGED
@@ -1,282 +1,85 @@
1
- 0.12.0 - February 3, 2010
2
- Removed adapters for xml and connections (these will be provided via separate gems)
3
- - default xml generator is Builder
4
- - default http connection is Net::Http
5
- Removed JRuby/Direct connection stuff (this will be in a new library)
6
- Updated specs
1
+ 2.6.0
7
2
 
8
- 0.11.0 - November 17, 2009
9
- Removed pagination feature yet again... keeping it in RSolr::Ext until a better API can be thought up.
10
- Updated Xout with fixed version - thanks to Mat Brown
11
- - bug in escaping consecutive special characters
12
- - moved regexp patterns out of loop, into "static" variables instead
3
+ - Stop testing on Ruby 2. https://github.com/rsolr/rsolr/pull/237
4
+ - Set solr version to 8.11.3. https://github.com/rsolr/rsolr/pull/238
5
+ - Add newer rubies to the test matrix. https://github.com/rsolr/rsolr/pull/239
6
+ - Sanitizing URIs displayed in error messages. https://github.com/rsolr/rsolr/pull/236
13
7
 
14
- 0.10.1 - November 13, 2009
15
- Same changes as 0.10.0 -- but fixing version number problems
8
+ 2.5.0
16
9
 
17
- 0.10.0 - November 13, 2009
18
- Changed RSolr.connect to return Http connection only:
19
- RSolr.connect :url=>'xxx'
20
- Added RSolr.direct_connect to handle the creation of SolrDirectConnections
21
- rsolr = RSolr.direct_connect :home_dir=>''
22
-
23
- # can also use a block so the connection will get closed automatically:
24
- RSolr.direct_connect :home_dir=>'' do |rsolr|
25
- # query...
26
- end
27
- Added paginate method to RSolr::Client
28
- - This method requires 2 new arguments: current page and per page:
29
- solr.paginate 1, 10, :q=>''
30
- - handler paths can be set:
31
- solr.paginate 1, 10, '/music', :q=>''
32
- - handler paths can also be set by method names:
33
- solr.paginate_music 1, 10
34
- Removed :dist_dir option from Direct connection options -- you gotta load your own java libs. See examples/direct.rb
35
- Updated specs
10
+ - Sorry, not human-edited: https://github.com/rsolr/rsolr/compare/v2.4.0...v2.5.0
36
11
 
37
- 0.9.7.2 - November 6, 2009
38
- fixed gem spec, added client.rb
39
12
 
40
- 0.9.7.1 - November 5, 2009
41
- added support for multibyte url characters in RSolr::Connection::Utils
42
- - this is because Ruby 1.9's String size method is different than 1.8
13
+ 2.4.0
43
14
 
44
- 0.9.7 - October 23, 2009
45
- Removed XML message builders - using pure Ruby generator instead
46
- - benchmarks show generation speed is a little faster than libxml
47
- - minimal xml escaping so binary posting to Solr should no longer be a problem.
48
- Changed response.adapter_resonse to response.raw
49
- Removed HTTP adapters - sticking with NetHTTP
50
- Removed builder dependency in gemspec
51
- Removed Adapter and HTTPClient modules
52
- Moved HTTPCLient::Util to Connection::Utils
53
- Updated all tests
15
+ - Raise specific timeout error for solr timeouts. https://github.com/rsolr/rsolr/pull/214
16
+ - Pass `timeout` RSolr configuration through to Faraday, deprecate `read_timeout` Rsolr configuration. https://github.com/rsolr/rsolr/pull/215
17
+ - Better visibility of Solr error message in `RSolr::Error`. https://github.com/rsolr/rsolr/pull/222
18
+ - Add soft-commit function https://github.com/rsolr/rsolr/pull/210 (thanks @giteshnandre)
19
+ - Avoid encoding exception in error message display https://github.com/rsolr/rsolr/pull/208 (thanks @expajp)
20
+ - Fix JSON generator for atomic updates of array fields https://github.com/rsolr/rsolr/pull/201 (thanks @serggl)
54
21
 
55
- 0.9.6 - September 9, 2009
56
- Added ability to create direct connections from existing Java::OrgApacheSolrCore::SolrCore
57
- Added ability to send queries using POST
58
- - solr.request '/select', :q=>'*:*', :method=>:post
59
22
 
60
- 0.9.5 - September 4, 2009
61
- Removed Array #extract_options!
62
- Removed the Connection #send_request method (now #request)
63
- Removed the Connection #select method -- still works, but this now ends up calling Connection #method_missing
64
- Removed HTTPClient::Connector
65
- - HTTPClient now uses a method called #connect (like RSolr.connect)
66
- - This method accepts 1 or 2 args, see the #connect method comments
67
- Changed the way the HTTP client adapter is set. Now just pass in when connecting:
68
- - RSolr.connect(:http, :adapter=>curb, :url=>'http://solr.com')
69
- Moved Message::Builders to Message::Adapter
70
- Made Connection a module and moved class methods to "Base" class
71
- Made HTTPClient a module and moved class methods to "Base" class
72
- Removed the "adapter.rb" files -- Adapter modules are defined in the parent module file.
73
- Moved Message module/singleton functionality to Message::Builder class
74
- XML message adapter API change: no longer a singleton, must instantiate Message::Builder
75
- Made RSolr::Connection #message public -- can change the adapter as needed; connection.message.adapter = RSolr::Message::Adapter::LibXML.new
76
- More tests for HTTPClient::Util
77
- Simplified url/query building in HTTPClient::Util
78
- Updated tests accordingly
23
+ 2.3.0
79
24
 
80
- 0.9.1 - July 22, 2009
81
- Added LibXml builder support (Thanks to Mat Brown - github.com/outoftime)
25
+ - Sorry, not human-edited: https://github.com/rsolr/rsolr/compare/v2.2.0...v2.3.0
82
26
 
83
- 0.9.0 - July 17, 2009
84
- Added ability to use DirectSolrConnection instance when connecting
85
- Loading Java classes using full package name
27
+ 2.2.0
86
28
 
87
- 0.8.9 - June 30, 2009
88
- Deprecated hash syntax fix from outoftime/rsolr (Mat Brown)
29
+ - Sorry, not human-edited: https://github.com/rsolr/rsolr/compare/v2.1.0...v2.2.0
89
30
 
90
- 0.8.8 - May 6, 2009
91
- Added method :request to RSolr::Connection
92
- - this method is an alias for send_request
31
+ 2.1.0
93
32
 
94
- 0.8.7 - May 6, 2009
95
- Added method_missing to RSolr::Connection, which sets the request handler path,
96
- based on the method name:
97
- # this sends a request like: /music_library?q=>coltrane
98
- solr.music_library :q=>'coltrane'
99
- Removed the core_ext file, put the Array extension code directly into rsolr.rb
33
+ - Sorry, not human-edited: https://github.com/rsolr/rsolr/compare/v2.0.0...v2.1.0
100
34
 
101
- 0.8.6 - April 25, 2009
102
- Removed the Mash stuff -- which means the response keys from solr are only accessable using String based keys.
103
- Use RSolr::Ext if you want more magic.
35
+ 2.0.0
104
36
 
105
- 0.8.5 - April 7, 2009
106
- The RSolr::Message #add method now accepts a single Message::Document or an array of Message::Document objects
107
- The Message::Document class has a new method: #add_field
108
- Tests added for both changes
109
- Permissions of files changed to non-executable
110
- -- the above changes were made by Mat Brown, thank you Mat!
111
- Added CannedSolrResponse module for mocks in the specs... not used yet
37
+ - Sorry, not human-edited: https://github.com/rsolr/rsolr/compare/v2.0.0.pre1...v2.0.0
112
38
 
113
- 0.8.4 - April 3, 2009
114
- New test suite using RSpec and mocks coming. Run "rake spec"
115
- - added specs for RSolr and RSolr::Connection
39
+ 2.0.0.pre1
116
40
 
117
- 0.8.3 - April 3, 2009
118
- RSolr::Connection
119
- - removed the block functionality of send_request and related methods
120
- - this was used to gain access to the raw adapter response
121
- - added #adapter_response method to all response objects
122
- - this is used to get access to the original adapter response:
123
- response = rsolr.select(:q=>'test')
124
- response.adapter_response[:status_code]
41
+ In this release, we've added many new features, including:
125
42
 
126
- 0.8.2 - March 24, 2009
127
- Changed RSolr.connect method to accept one options hash argument
128
- - This hash gets passed to the Connection object and the adapter
129
- Updated tests, examples and README.rdoc to reflect this change
130
- Bumped the version up in gemspec and the RSolr module
43
+ - a new JSON request generator (enabled by default, replacing the XML-based requests) (@mootprinter)
44
+ - using Faraday for added flexibility for HTTP configuration
45
+ - native support for nested child documents and atomic updates in RSolr::Document and RSolr::Client.add
46
+ - better support for custom field value converters (@solenko)
47
+ - removing code deprecated in RSolr 1.x (@vipulnsward, and others)
131
48
 
132
- 0.8.1 - March 12, 2009
133
- Added RSolr.escape and RSolr::Connection.new.escape
134
- - tests in rsolr_test
135
- Added ability to set doc and field attributes when adding documents via Message.add
136
49
 
137
- 0.8.0 - March 6, 2009
138
- Removed all response wrapper classes (now returning a simple hash for ruby responses)
139
- Removed RSolr::Query - this library needs an external partner lib, RSolrExt etc..
140
- changed query method to select
141
- added send_request method to Connection for custom requests:
142
- send_request '/my-handler', {:start=>0}, post_data=nil
143
- moved Connection::Base to Connection
144
- moved Connection::Adapter::* to Adapter::*
145
-
146
- 0.7.1 - February 27, 2009
147
- Added simple query helper module -> RSolr::Query
148
- Added tests for RSolr::Query
149
- Modified Test::Unit::TestCase in test/test_helpers.rb
50
+ 1.0.12
51
+ - Fix bug where specifying the wt property as a string, would add the supplied value to the default ('ruby') rather than overriding it.
150
52
 
151
- 0.7.0 - February 20, 2009
152
- Removed all param mapping behavior, code and tests
153
- - this stuff just gunks up rsolr and should be in an extension of some sort
154
- Can now specify the request handler in all RSolr::Connection::Base methods as the first argument:
155
- - solr.query 'select', :q=>'ipod'
156
- - solr.query 'catalog', :q=>'humphry'
157
- - solr.query :q=>'big' # defaults to the /select handler
53
+ 1.0.11
54
+ - add RSolr.solr_escape method and add deprecation messages to RSolr.escape (ndushay)
55
+ - use stdlib URI.escape methods instead of homegrown in RSolr::URI (ndushay)
56
+ - fix bug with Rsolr::Uri.create adding trailing slash if query params (ndushay)
57
+ - update rake tasks (cbeer)
58
+ - add Ruby 2.2.0 to travis ci build (ndushay)
59
+ - Housekeeping (badges to README, license in gemspec, correct url in gemspec ...) (ndushay)
60
+ - Improve rdoc styling (udaykadaboina)
61
+ - Support setting default_wt per connection via its options. (jcoleman)
62
+ - eliminates the usage of per-instance `extend` (jcoleman)
63
+ - Upgrade to RSpec 3 (blackwinter, adamjonas, cbeer)
64
+ - Fixed RSolr::Error to_s (PofMagicfingers)
65
+ 1.0.10 xxx
158
66
 
159
- 0.6.9 - January 29, 2009
160
- Simplified facet response methods
161
- Main facet method is called #facets
162
- - returns an array of Response::Facet instances
163
- - each Facet instance has field and values attributes
164
- -- the values attribute is an array with FacetValue instances which have @value and @hits
165
- Added ability to set Connection::Base @param_adapters using :dismax or :standard
166
- instead of full class constant
167
- updated comments for #search method
168
- Updated tests
169
- Bumped up version
170
-
171
- 0.6.8 - January 28, 2009
172
- New method added to RSolr::Connection::Base - #find_values_for_facet
173
- This method searches for facet values only, and sets the :rows param to 0
174
- - returns an RSolr::Response::Query::Base instance
175
- Example:
176
- search_params[:facets][:offset]=0
177
- search_params[:facets][:limit]=5
178
- response = solr.search_facet_by_name(:language_facet, search_params)
179
-
180
- 0.6.7 - January 27, 2009
181
- The Symbol extension in core_ext.rb was cause for some REALLY painful debuging - so I removed it :(
182
- This means no more :q.alt or :facet.field until RSolr gets a really nice query-builder module happening.
183
-
184
- 0.6.6 - January 26, 2009
185
- Added #get method helper to RSolr::Response::Query::DocExt
186
- # doc.get(key, opts)
187
- # key is the name of the field
188
- # opts is a hash with the following valid keys:
189
- # - :sep - a string used for joining multivalued field values
190
- # - :default - a value to return when the key doesn't exist
191
- # if :sep is nil and the field is a multivalued field, the array is returned
192
-
193
- 0.6.5 - January 26, 2009
194
- Removed to_mash everywhere, except for usage in RSolr::Response
195
- Added a #close method to the Direct adapter
196
- - this closes the connection and sets the @connection variable to nil
197
- Removed to_mash in RSolr::Connection::Base
198
- Changed RSolr::Response::Query::Doc to DocExt
199
- - this no longer extends Mash
200
- - each doc in the response now uses the #extend method to mixin the new DocExt module
201
- Added #teardown method in direct connection test, this method closes the connection
202
- Updated the connection test methods a bit
203
-
204
- 0.6.4 - January 26, 2009
205
- Updated the mapping output for the :filters and :phrase_filters (when using the #search method)
206
- - now sending multiple fq's instead of one
207
- Updated mapping tests
208
-
209
- 0.6.3 - January 21, 2009
210
- Added a new param mapping module: RSolr::Connection::ParamMapping
211
- Mapping only for fields that need conversion/escaping or nested (facet.*) etc.
212
- This new module can be activated by using the #search method
213
- New tests for ParamMapping
214
-
215
- 0.6.2 - January 14, 2009
216
- Removed mapping and indexer modules -- seems to me that a general purpose mapping library
217
- would be more valuable than an embedded module in RSolr ( RMapper ?)
218
- This helps lighten RSolr a bit too
219
-
220
- 0.6.1 - January 13, 2009
221
- Removed SearchExt and mapping until this library gets some real use
222
- The only param mapping now is for :page and :per_page via the #search method
223
- The Connection::Base #query method does NO mapping now
224
-
225
- 0.6.0 - January 9, 2009
226
- Removed first argument from RSolr.connect, the "adapter_name"
227
- The adapter is now set using the :adapter key when passing in options to RSolr.connect:
228
- s = RSolr.connect(:adapter=>:direct)
229
-
230
- 0.5.9 - January 7, 2009
231
- Finally brought in the ExtLib Mash classes for incoming params and response hashes from solr
232
- - this gives the ability to access/set values for hashes using strings OR symbols (HashWithIndifferentAccess)
233
- Organized response tests
234
- Added more response tests
235
- Simplified the RSolr::Response::Base class by supporting only raw/string ruby input
236
- Added method to Response::IndexInfo for grabbing a Solr field list
237
-
238
- 0.5.7 - January 5, 2009
239
- Changed name from Solr to RSolr, changed all references to Solr to RSolr
240
- Added new tests for RSolr::Mapper and RSolr::Message
241
-
242
- 0.5.6 - December 30, 2008
243
- solr.gemspec cleanedup thanks to shairontoledo on github! :)
244
- Added Solr::Response::Query::Facet module with helpers from the delsolr project
245
- Also added test stub in test/connection/search_ext_test_methods.rb
246
- Fixed pagination math errors
247
- Added new SearchExt helper field: :phrase_filters
248
- This will add quoted values to the :filters (fq solr param) hash for doing easier facet requests
249
-
250
- Be sure to check out the new demo app: http://github.com/mwmitchell/consuminator/tree/master
251
-
252
- 0.5.5 - December 29, 2008
253
- Fixed bug where accessing a field by method name failed:
254
- docs.each do |doc|
255
- doc.timestamp
256
- end
257
- Fixed bug where using the #has? method on a doc failed:
258
- docs.each do |doc|
259
- doc.has?('timestamp')
260
- end
261
- Removed invalid autoload in Solr module
262
- Fixed spelling error in Solr::Connection::SearchExt (thanks to matthewrudy)
263
-
264
- 0.5.4 - December 29, 2008
265
- Re-organized the main Solr adapters, they're now in Solr::Connection::Adapter instead of Solr::Adapter
266
- All responses from HTTPClient and Connection::Adapter::Direct return a hash with the following keys:
267
- :status_code
268
- :body
269
- :params
270
- :url
271
- :path
272
- :headers
273
- :data
274
- This hash is now available in the solr response objects as #source - this will be useful in testing and debugging by allowing you to see the generated params and queries... example:
275
- response = Solr.query(:q=>'*:*')
276
- response.source[:params]
277
- response.source[:body]
278
- response.source[:url]
279
- Added MultiValue field support in Solr::Message, thanks to Fouad Mardini
280
- Bug in Solr::Connection::SearchExt where the :q params was not getting generated - fixed by Fouad Mardini
281
- Organized tests a bit, moved connection tests into test/connection
282
- Fixed a bug in Solr::Connection::Adapter::HTTP where invalid HTTP POST headers were being generated
67
+ 1.0.8
68
+ - Fix connection refused errors in specs + add basic auth support (Denis Goeury)
69
+ - Ability to set :retry_503, the number of retry attempts for a 503 response
70
+ with a Retry-After header.
71
+ 1.0.7
72
+ - Response body encoding is set to response charset in Ruby >= 1.9
73
+ - Ability to set :read_timeout and :open_timeout when creating new instance of RSolr
74
+ 1.0.6
75
+ - More dependency fixups
76
+ 1.0.5
77
+ - Dependency fixups
78
+ 1.0.4
79
+ - The "builder" gem dependency is less strict: ~> 2.1.2
80
+ - RSolr.version is no longer read from a file
81
+ - Gemspec updated -- less strict dev/test versions
82
+ - Jeweler is no longer used for building the gemspec
83
+ 1.0.3
84
+ - Proper encodings in Ruby 1.9
85
+ - Applied pull request from https://github.com/mwmitchell/rsolr/pull/20
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "builder", ">= 2.1.2"
6
+
7
+ if defined? JRUBY_VERSION
8
+ # HTTP.rb (used by solr_wrapper to download solr for integration testing) fails
9
+ # to download the full contents of files (under jruby)?
10
+ gem "http", '< 5', platforms: :jruby
11
+ end
12
+
13
+ gem 'faraday', ENV['FARADAY_VERSION'] if ENV['FARADAY_VERSION']