acts_as_solr 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/.gitignore +8 -0
  2. data/CHANGE_LOG +233 -0
  3. data/FORKED_CHANGES +3 -0
  4. data/LICENSE +19 -0
  5. data/README.markdown +94 -0
  6. data/README.rdoc +84 -0
  7. data/Rakefile +57 -0
  8. data/TESTING_THE_PLUGIN +25 -0
  9. data/VERSION +1 -0
  10. data/acts_as_solr.gemspec +237 -0
  11. data/config/solr.yml +15 -0
  12. data/config/solr_environment.rb +22 -0
  13. data/init.rb +21 -0
  14. data/install.rb +11 -0
  15. data/lib/acts_as_solr.rb +61 -0
  16. data/lib/acts_methods.rb +284 -0
  17. data/lib/class_methods.rb +239 -0
  18. data/lib/common_methods.rb +89 -0
  19. data/lib/deprecation.rb +61 -0
  20. data/lib/instance_methods.rb +181 -0
  21. data/lib/lazy_document.rb +18 -0
  22. data/lib/parser_methods.rb +230 -0
  23. data/lib/search_results.rb +69 -0
  24. data/lib/solr/connection.rb +191 -0
  25. data/lib/solr/document.rb +78 -0
  26. data/lib/solr/exception.rb +13 -0
  27. data/lib/solr/field.rb +39 -0
  28. data/lib/solr/importer/array_mapper.rb +26 -0
  29. data/lib/solr/importer/delimited_file_source.rb +38 -0
  30. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  31. data/lib/solr/importer/mapper.rb +51 -0
  32. data/lib/solr/importer/solr_source.rb +43 -0
  33. data/lib/solr/importer/xpath_mapper.rb +35 -0
  34. data/lib/solr/importer.rb +19 -0
  35. data/lib/solr/indexer.rb +52 -0
  36. data/lib/solr/request/add_document.rb +63 -0
  37. data/lib/solr/request/base.rb +36 -0
  38. data/lib/solr/request/commit.rb +31 -0
  39. data/lib/solr/request/delete.rb +50 -0
  40. data/lib/solr/request/dismax.rb +46 -0
  41. data/lib/solr/request/index_info.rb +22 -0
  42. data/lib/solr/request/modify_document.rb +51 -0
  43. data/lib/solr/request/optimize.rb +21 -0
  44. data/lib/solr/request/ping.rb +36 -0
  45. data/lib/solr/request/select.rb +56 -0
  46. data/lib/solr/request/spellcheck.rb +30 -0
  47. data/lib/solr/request/standard.rb +402 -0
  48. data/lib/solr/request/update.rb +23 -0
  49. data/lib/solr/request.rb +26 -0
  50. data/lib/solr/response/add_document.rb +17 -0
  51. data/lib/solr/response/base.rb +42 -0
  52. data/lib/solr/response/commit.rb +17 -0
  53. data/lib/solr/response/delete.rb +13 -0
  54. data/lib/solr/response/dismax.rb +8 -0
  55. data/lib/solr/response/index_info.rb +26 -0
  56. data/lib/solr/response/modify_document.rb +17 -0
  57. data/lib/solr/response/optimize.rb +14 -0
  58. data/lib/solr/response/ping.rb +28 -0
  59. data/lib/solr/response/ruby.rb +42 -0
  60. data/lib/solr/response/select.rb +17 -0
  61. data/lib/solr/response/spellcheck.rb +20 -0
  62. data/lib/solr/response/standard.rb +64 -0
  63. data/lib/solr/response/xml.rb +42 -0
  64. data/lib/solr/response.rb +27 -0
  65. data/lib/solr/solrtasks.rb +27 -0
  66. data/lib/solr/util.rb +32 -0
  67. data/lib/solr/xml.rb +44 -0
  68. data/lib/solr.rb +21 -0
  69. data/lib/solr_fixtures.rb +13 -0
  70. data/lib/tasks/database.rake +18 -0
  71. data/lib/tasks/solr.rake +137 -0
  72. data/lib/tasks/test.rake +7 -0
  73. data/lib/will_paginate_support.rb +12 -0
  74. data/solr/CHANGES.txt +1207 -0
  75. data/solr/LICENSE.txt +712 -0
  76. data/solr/NOTICE.txt +90 -0
  77. data/solr/etc/jetty.xml +205 -0
  78. data/solr/etc/webdefault.xml +379 -0
  79. data/solr/lib/easymock.jar +0 -0
  80. data/solr/lib/jetty-6.1.3.jar +0 -0
  81. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  82. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  83. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  84. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  85. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  86. data/solr/lib/servlet-api-2.4.jar +0 -0
  87. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  88. data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
  89. data/solr/logs/.empty-dir-for-git +0 -0
  90. data/solr/solr/README.txt +52 -0
  91. data/solr/solr/bin/abc +176 -0
  92. data/solr/solr/bin/abo +176 -0
  93. data/solr/solr/bin/backup +108 -0
  94. data/solr/solr/bin/backupcleaner +142 -0
  95. data/solr/solr/bin/commit +128 -0
  96. data/solr/solr/bin/optimize +129 -0
  97. data/solr/solr/bin/readercycle +129 -0
  98. data/solr/solr/bin/rsyncd-disable +77 -0
  99. data/solr/solr/bin/rsyncd-enable +76 -0
  100. data/solr/solr/bin/rsyncd-start +145 -0
  101. data/solr/solr/bin/rsyncd-stop +105 -0
  102. data/solr/solr/bin/scripts-util +83 -0
  103. data/solr/solr/bin/snapcleaner +148 -0
  104. data/solr/solr/bin/snapinstaller +168 -0
  105. data/solr/solr/bin/snappuller +248 -0
  106. data/solr/solr/bin/snappuller-disable +77 -0
  107. data/solr/solr/bin/snappuller-enable +77 -0
  108. data/solr/solr/bin/snapshooter +109 -0
  109. data/solr/solr/conf/admin-extra.html +31 -0
  110. data/solr/solr/conf/protwords.txt +21 -0
  111. data/solr/solr/conf/schema.xml +126 -0
  112. data/solr/solr/conf/scripts.conf +24 -0
  113. data/solr/solr/conf/solrconfig.xml +458 -0
  114. data/solr/solr/conf/stopwords.txt +57 -0
  115. data/solr/solr/conf/synonyms.txt +31 -0
  116. data/solr/solr/conf/xslt/example.xsl +132 -0
  117. data/solr/solr/conf/xslt/example_atom.xsl +63 -0
  118. data/solr/solr/conf/xslt/example_rss.xsl +62 -0
  119. data/solr/start.jar +0 -0
  120. data/solr/tmp/.empty-dir-for-git +0 -0
  121. data/solr/webapps/solr.war +0 -0
  122. data/test/config/solr.yml +2 -0
  123. data/test/db/connections/mysql/connection.rb +10 -0
  124. data/test/db/connections/sqlite/connection.rb +8 -0
  125. data/test/db/migrate/001_create_books.rb +15 -0
  126. data/test/db/migrate/002_create_movies.rb +12 -0
  127. data/test/db/migrate/003_create_categories.rb +11 -0
  128. data/test/db/migrate/004_create_electronics.rb +16 -0
  129. data/test/db/migrate/005_create_authors.rb +12 -0
  130. data/test/db/migrate/006_create_postings.rb +9 -0
  131. data/test/db/migrate/007_create_posts.rb +13 -0
  132. data/test/db/migrate/008_create_gadgets.rb +11 -0
  133. data/test/fixtures/authors.yml +9 -0
  134. data/test/fixtures/books.yml +13 -0
  135. data/test/fixtures/categories.yml +7 -0
  136. data/test/fixtures/db_definitions/mysql.sql +41 -0
  137. data/test/fixtures/electronics.yml +49 -0
  138. data/test/fixtures/movies.yml +9 -0
  139. data/test/fixtures/postings.yml +10 -0
  140. data/test/functional/acts_as_solr_test.rb +413 -0
  141. data/test/functional/association_indexing_test.rb +37 -0
  142. data/test/functional/faceted_search_test.rb +163 -0
  143. data/test/functional/multi_solr_search_test.rb +51 -0
  144. data/test/models/author.rb +10 -0
  145. data/test/models/book.rb +10 -0
  146. data/test/models/category.rb +8 -0
  147. data/test/models/electronic.rb +21 -0
  148. data/test/models/gadget.rb +9 -0
  149. data/test/models/movie.rb +17 -0
  150. data/test/models/novel.rb +2 -0
  151. data/test/models/post.rb +3 -0
  152. data/test/models/posting.rb +11 -0
  153. data/test/test_helper.rb +51 -0
  154. data/test/unit/acts_methods_shoulda.rb +70 -0
  155. data/test/unit/class_methods_shoulda.rb +90 -0
  156. data/test/unit/common_methods_shoulda.rb +112 -0
  157. data/test/unit/instance_methods_shoulda.rb +326 -0
  158. data/test/unit/lazy_document_shoulda.rb +35 -0
  159. data/test/unit/parser_instance.rb +19 -0
  160. data/test/unit/parser_methods_shoulda.rb +279 -0
  161. data/test/unit/solr_instance.rb +46 -0
  162. data/test/unit/test_helper.rb +26 -0
  163. metadata +259 -0
@@ -0,0 +1,46 @@
1
+ require 'instance_methods'
2
+
3
+ class SolrInstance
4
+ include ActsAsSolr::InstanceMethods
5
+ attr_accessor :configuration, :solr_configuration, :name
6
+
7
+ def initialize(name = "Chunky bacon!")
8
+ @name = name
9
+ end
10
+
11
+ def self.primary_key
12
+ "id"
13
+ end
14
+
15
+ def logger
16
+ @logger ||= Logger.new(StringIO.new)
17
+ end
18
+
19
+ def record_id(obj)
20
+ 10
21
+ end
22
+
23
+ def boost_rate
24
+ 10.0
25
+ end
26
+
27
+ def irate
28
+ 8.0
29
+ end
30
+
31
+ def name_for_solr
32
+ name
33
+ end
34
+
35
+ def id_for_solr
36
+ "bogus"
37
+ end
38
+
39
+ def type_for_solr
40
+ "humbug"
41
+ end
42
+
43
+ def get_solr_field_type(args)
44
+ "s"
45
+ end
46
+ end
@@ -0,0 +1,26 @@
1
+ $:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "lib"))
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+ require 'logger'
6
+
7
+ if RUBY_VERSION =~ /^1\.9/
8
+ puts "\nRunning the unit test suite doesn't as of yet work with Ruby 1.9, because Mocha hasn't yet been updated to use minitest."
9
+ puts
10
+ exit 1
11
+ end
12
+
13
+ require 'mocha'
14
+ gem 'thoughtbot-shoulda'
15
+ require 'shoulda'
16
+
17
+
18
+ $log = Logger.new(STDERR)
19
+ $log.level = Logger::INFO
20
+
21
+ def loudly
22
+ $log.level = Logger::DEBUG
23
+ yield
24
+ ensure
25
+ $log.level = Logger::INFO
26
+ end
metadata ADDED
@@ -0,0 +1,259 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_solr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kyle Maxwell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-18 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Acts As Solr
26
+ email: kyle@onemorecloud.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.markdown
34
+ - README.rdoc
35
+ files:
36
+ - .gitignore
37
+ - CHANGE_LOG
38
+ - FORKED_CHANGES
39
+ - LICENSE
40
+ - README.markdown
41
+ - README.rdoc
42
+ - Rakefile
43
+ - TESTING_THE_PLUGIN
44
+ - VERSION
45
+ - acts_as_solr.gemspec
46
+ - config/solr.yml
47
+ - config/solr_environment.rb
48
+ - init.rb
49
+ - install.rb
50
+ - lib/acts_as_solr.rb
51
+ - lib/acts_methods.rb
52
+ - lib/class_methods.rb
53
+ - lib/common_methods.rb
54
+ - lib/deprecation.rb
55
+ - lib/instance_methods.rb
56
+ - lib/lazy_document.rb
57
+ - lib/parser_methods.rb
58
+ - lib/search_results.rb
59
+ - lib/solr.rb
60
+ - lib/solr/connection.rb
61
+ - lib/solr/document.rb
62
+ - lib/solr/exception.rb
63
+ - lib/solr/field.rb
64
+ - lib/solr/importer.rb
65
+ - lib/solr/importer/array_mapper.rb
66
+ - lib/solr/importer/delimited_file_source.rb
67
+ - lib/solr/importer/hpricot_mapper.rb
68
+ - lib/solr/importer/mapper.rb
69
+ - lib/solr/importer/solr_source.rb
70
+ - lib/solr/importer/xpath_mapper.rb
71
+ - lib/solr/indexer.rb
72
+ - lib/solr/request.rb
73
+ - lib/solr/request/add_document.rb
74
+ - lib/solr/request/base.rb
75
+ - lib/solr/request/commit.rb
76
+ - lib/solr/request/delete.rb
77
+ - lib/solr/request/dismax.rb
78
+ - lib/solr/request/index_info.rb
79
+ - lib/solr/request/modify_document.rb
80
+ - lib/solr/request/optimize.rb
81
+ - lib/solr/request/ping.rb
82
+ - lib/solr/request/select.rb
83
+ - lib/solr/request/spellcheck.rb
84
+ - lib/solr/request/standard.rb
85
+ - lib/solr/request/update.rb
86
+ - lib/solr/response.rb
87
+ - lib/solr/response/add_document.rb
88
+ - lib/solr/response/base.rb
89
+ - lib/solr/response/commit.rb
90
+ - lib/solr/response/delete.rb
91
+ - lib/solr/response/dismax.rb
92
+ - lib/solr/response/index_info.rb
93
+ - lib/solr/response/modify_document.rb
94
+ - lib/solr/response/optimize.rb
95
+ - lib/solr/response/ping.rb
96
+ - lib/solr/response/ruby.rb
97
+ - lib/solr/response/select.rb
98
+ - lib/solr/response/spellcheck.rb
99
+ - lib/solr/response/standard.rb
100
+ - lib/solr/response/xml.rb
101
+ - lib/solr/solrtasks.rb
102
+ - lib/solr/util.rb
103
+ - lib/solr/xml.rb
104
+ - lib/solr_fixtures.rb
105
+ - lib/tasks/database.rake
106
+ - lib/tasks/solr.rake
107
+ - lib/tasks/test.rake
108
+ - lib/will_paginate_support.rb
109
+ - solr/CHANGES.txt
110
+ - solr/LICENSE.txt
111
+ - solr/NOTICE.txt
112
+ - solr/etc/jetty.xml
113
+ - solr/etc/webdefault.xml
114
+ - solr/lib/easymock.jar
115
+ - solr/lib/jetty-6.1.3.jar
116
+ - solr/lib/jetty-util-6.1.3.jar
117
+ - solr/lib/jsp-2.1/ant-1.6.5.jar
118
+ - solr/lib/jsp-2.1/core-3.1.1.jar
119
+ - solr/lib/jsp-2.1/jsp-2.1.jar
120
+ - solr/lib/jsp-2.1/jsp-api-2.1.jar
121
+ - solr/lib/servlet-api-2.4.jar
122
+ - solr/lib/servlet-api-2.5-6.1.3.jar
123
+ - solr/lib/xpp3-1.1.3.4.O.jar
124
+ - solr/logs/.empty-dir-for-git
125
+ - solr/solr/README.txt
126
+ - solr/solr/bin/abc
127
+ - solr/solr/bin/abo
128
+ - solr/solr/bin/backup
129
+ - solr/solr/bin/backupcleaner
130
+ - solr/solr/bin/commit
131
+ - solr/solr/bin/optimize
132
+ - solr/solr/bin/readercycle
133
+ - solr/solr/bin/rsyncd-disable
134
+ - solr/solr/bin/rsyncd-enable
135
+ - solr/solr/bin/rsyncd-start
136
+ - solr/solr/bin/rsyncd-stop
137
+ - solr/solr/bin/scripts-util
138
+ - solr/solr/bin/snapcleaner
139
+ - solr/solr/bin/snapinstaller
140
+ - solr/solr/bin/snappuller
141
+ - solr/solr/bin/snappuller-disable
142
+ - solr/solr/bin/snappuller-enable
143
+ - solr/solr/bin/snapshooter
144
+ - solr/solr/conf/admin-extra.html
145
+ - solr/solr/conf/protwords.txt
146
+ - solr/solr/conf/schema.xml
147
+ - solr/solr/conf/scripts.conf
148
+ - solr/solr/conf/solrconfig.xml
149
+ - solr/solr/conf/stopwords.txt
150
+ - solr/solr/conf/synonyms.txt
151
+ - solr/solr/conf/xslt/example.xsl
152
+ - solr/solr/conf/xslt/example_atom.xsl
153
+ - solr/solr/conf/xslt/example_rss.xsl
154
+ - solr/start.jar
155
+ - solr/tmp/.empty-dir-for-git
156
+ - solr/webapps/solr.war
157
+ - test/config/solr.yml
158
+ - test/db/connections/mysql/connection.rb
159
+ - test/db/connections/sqlite/connection.rb
160
+ - test/db/migrate/001_create_books.rb
161
+ - test/db/migrate/002_create_movies.rb
162
+ - test/db/migrate/003_create_categories.rb
163
+ - test/db/migrate/004_create_electronics.rb
164
+ - test/db/migrate/005_create_authors.rb
165
+ - test/db/migrate/006_create_postings.rb
166
+ - test/db/migrate/007_create_posts.rb
167
+ - test/db/migrate/008_create_gadgets.rb
168
+ - test/fixtures/authors.yml
169
+ - test/fixtures/books.yml
170
+ - test/fixtures/categories.yml
171
+ - test/fixtures/db_definitions/mysql.sql
172
+ - test/fixtures/electronics.yml
173
+ - test/fixtures/movies.yml
174
+ - test/fixtures/postings.yml
175
+ - test/functional/acts_as_solr_test.rb
176
+ - test/functional/association_indexing_test.rb
177
+ - test/functional/faceted_search_test.rb
178
+ - test/functional/multi_solr_search_test.rb
179
+ - test/models/author.rb
180
+ - test/models/book.rb
181
+ - test/models/category.rb
182
+ - test/models/electronic.rb
183
+ - test/models/gadget.rb
184
+ - test/models/movie.rb
185
+ - test/models/novel.rb
186
+ - test/models/post.rb
187
+ - test/models/posting.rb
188
+ - test/test_helper.rb
189
+ - test/unit/acts_methods_shoulda.rb
190
+ - test/unit/class_methods_shoulda.rb
191
+ - test/unit/common_methods_shoulda.rb
192
+ - test/unit/instance_methods_shoulda.rb
193
+ - test/unit/lazy_document_shoulda.rb
194
+ - test/unit/parser_instance.rb
195
+ - test/unit/parser_methods_shoulda.rb
196
+ - test/unit/solr_instance.rb
197
+ - test/unit/test_helper.rb
198
+ has_rdoc: true
199
+ homepage: http://github.com/onemorecloud/acts_as_solr
200
+ licenses: []
201
+
202
+ post_install_message:
203
+ rdoc_options:
204
+ - --charset=UTF-8
205
+ require_paths:
206
+ - lib
207
+ required_ruby_version: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: "0"
212
+ version:
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: "0"
218
+ version:
219
+ requirements: []
220
+
221
+ rubyforge_project:
222
+ rubygems_version: 1.3.4
223
+ signing_key:
224
+ specification_version: 3
225
+ summary: Solr integration for rails
226
+ test_files:
227
+ - test/db/connections/mysql/connection.rb
228
+ - test/db/connections/sqlite/connection.rb
229
+ - test/db/migrate/001_create_books.rb
230
+ - test/db/migrate/002_create_movies.rb
231
+ - test/db/migrate/003_create_categories.rb
232
+ - test/db/migrate/004_create_electronics.rb
233
+ - test/db/migrate/005_create_authors.rb
234
+ - test/db/migrate/006_create_postings.rb
235
+ - test/db/migrate/007_create_posts.rb
236
+ - test/db/migrate/008_create_gadgets.rb
237
+ - test/functional/acts_as_solr_test.rb
238
+ - test/functional/association_indexing_test.rb
239
+ - test/functional/faceted_search_test.rb
240
+ - test/functional/multi_solr_search_test.rb
241
+ - test/models/author.rb
242
+ - test/models/book.rb
243
+ - test/models/category.rb
244
+ - test/models/electronic.rb
245
+ - test/models/gadget.rb
246
+ - test/models/movie.rb
247
+ - test/models/novel.rb
248
+ - test/models/post.rb
249
+ - test/models/posting.rb
250
+ - test/test_helper.rb
251
+ - test/unit/acts_methods_shoulda.rb
252
+ - test/unit/class_methods_shoulda.rb
253
+ - test/unit/common_methods_shoulda.rb
254
+ - test/unit/instance_methods_shoulda.rb
255
+ - test/unit/lazy_document_shoulda.rb
256
+ - test/unit/parser_instance.rb
257
+ - test/unit/parser_methods_shoulda.rb
258
+ - test/unit/solr_instance.rb
259
+ - test/unit/test_helper.rb