muck-solr 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/CHANGE_LOG +239 -0
  2. data/LICENSE +19 -0
  3. data/README.markdown +118 -0
  4. data/README.rdoc +107 -0
  5. data/Rakefile +99 -0
  6. data/TESTING_THE_PLUGIN +25 -0
  7. data/VERSION.yml +4 -0
  8. data/config/solr.yml +15 -0
  9. data/config/solr_environment.rb +32 -0
  10. data/lib/acts_as_solr.rb +65 -0
  11. data/lib/acts_as_solr/acts_methods.rb +352 -0
  12. data/lib/acts_as_solr/class_methods.rb +236 -0
  13. data/lib/acts_as_solr/common_methods.rb +89 -0
  14. data/lib/acts_as_solr/deprecation.rb +61 -0
  15. data/lib/acts_as_solr/instance_methods.rb +165 -0
  16. data/lib/acts_as_solr/lazy_document.rb +18 -0
  17. data/lib/acts_as_solr/parser_methods.rb +203 -0
  18. data/lib/acts_as_solr/search_results.rb +68 -0
  19. data/lib/acts_as_solr/solr_fixtures.rb +13 -0
  20. data/lib/acts_as_solr/tasks.rb +10 -0
  21. data/lib/acts_as_solr/tasks/database.rake +16 -0
  22. data/lib/acts_as_solr/tasks/solr.rake +135 -0
  23. data/lib/acts_as_solr/tasks/test.rake +5 -0
  24. data/lib/solr.rb +26 -0
  25. data/lib/solr/connection.rb +177 -0
  26. data/lib/solr/document.rb +75 -0
  27. data/lib/solr/exception.rb +13 -0
  28. data/lib/solr/field.rb +36 -0
  29. data/lib/solr/importer.rb +19 -0
  30. data/lib/solr/importer/array_mapper.rb +26 -0
  31. data/lib/solr/importer/delimited_file_source.rb +38 -0
  32. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  33. data/lib/solr/importer/mapper.rb +51 -0
  34. data/lib/solr/importer/solr_source.rb +41 -0
  35. data/lib/solr/importer/xpath_mapper.rb +35 -0
  36. data/lib/solr/indexer.rb +52 -0
  37. data/lib/solr/request.rb +26 -0
  38. data/lib/solr/request/add_document.rb +58 -0
  39. data/lib/solr/request/base.rb +36 -0
  40. data/lib/solr/request/commit.rb +29 -0
  41. data/lib/solr/request/delete.rb +48 -0
  42. data/lib/solr/request/dismax.rb +46 -0
  43. data/lib/solr/request/index_info.rb +22 -0
  44. data/lib/solr/request/modify_document.rb +46 -0
  45. data/lib/solr/request/optimize.rb +19 -0
  46. data/lib/solr/request/ping.rb +36 -0
  47. data/lib/solr/request/select.rb +54 -0
  48. data/lib/solr/request/spellcheck.rb +30 -0
  49. data/lib/solr/request/standard.rb +402 -0
  50. data/lib/solr/request/update.rb +23 -0
  51. data/lib/solr/response.rb +27 -0
  52. data/lib/solr/response/add_document.rb +17 -0
  53. data/lib/solr/response/base.rb +42 -0
  54. data/lib/solr/response/commit.rb +15 -0
  55. data/lib/solr/response/delete.rb +13 -0
  56. data/lib/solr/response/dismax.rb +8 -0
  57. data/lib/solr/response/index_info.rb +26 -0
  58. data/lib/solr/response/modify_document.rb +17 -0
  59. data/lib/solr/response/optimize.rb +14 -0
  60. data/lib/solr/response/ping.rb +26 -0
  61. data/lib/solr/response/ruby.rb +42 -0
  62. data/lib/solr/response/select.rb +17 -0
  63. data/lib/solr/response/spellcheck.rb +20 -0
  64. data/lib/solr/response/standard.rb +60 -0
  65. data/lib/solr/response/xml.rb +39 -0
  66. data/lib/solr/solrtasks.rb +27 -0
  67. data/lib/solr/util.rb +32 -0
  68. data/lib/solr/xml.rb +44 -0
  69. data/solr/CHANGES.txt +1207 -0
  70. data/solr/LICENSE.txt +712 -0
  71. data/solr/NOTICE.txt +90 -0
  72. data/solr/etc/jetty.xml +205 -0
  73. data/solr/etc/webdefault.xml +379 -0
  74. data/solr/lib/easymock.jar +0 -0
  75. data/solr/lib/jetty-6.1.3.jar +0 -0
  76. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  77. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  78. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  79. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  80. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  81. data/solr/lib/servlet-api-2.4.jar +0 -0
  82. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  83. data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
  84. data/solr/solr/README.txt +52 -0
  85. data/solr/solr/bin/abc +176 -0
  86. data/solr/solr/bin/abo +176 -0
  87. data/solr/solr/bin/backup +108 -0
  88. data/solr/solr/bin/backupcleaner +142 -0
  89. data/solr/solr/bin/commit +128 -0
  90. data/solr/solr/bin/optimize +129 -0
  91. data/solr/solr/bin/readercycle +129 -0
  92. data/solr/solr/bin/rsyncd-disable +77 -0
  93. data/solr/solr/bin/rsyncd-enable +76 -0
  94. data/solr/solr/bin/rsyncd-start +145 -0
  95. data/solr/solr/bin/rsyncd-stop +105 -0
  96. data/solr/solr/bin/scripts-util +83 -0
  97. data/solr/solr/bin/snapcleaner +148 -0
  98. data/solr/solr/bin/snapinstaller +168 -0
  99. data/solr/solr/bin/snappuller +248 -0
  100. data/solr/solr/bin/snappuller-disable +77 -0
  101. data/solr/solr/bin/snappuller-enable +77 -0
  102. data/solr/solr/bin/snapshooter +109 -0
  103. data/solr/solr/conf/admin-extra.html +31 -0
  104. data/solr/solr/conf/protwords.txt +21 -0
  105. data/solr/solr/conf/schema.xml +126 -0
  106. data/solr/solr/conf/scripts.conf +24 -0
  107. data/solr/solr/conf/solrconfig.xml +458 -0
  108. data/solr/solr/conf/stopwords.txt +57 -0
  109. data/solr/solr/conf/synonyms.txt +31 -0
  110. data/solr/solr/conf/xslt/example.xsl +132 -0
  111. data/solr/solr/conf/xslt/example_atom.xsl +63 -0
  112. data/solr/solr/conf/xslt/example_rss.xsl +62 -0
  113. data/solr/start.jar +0 -0
  114. data/solr/webapps/solr.war +0 -0
  115. data/test/config/solr.yml +2 -0
  116. data/test/db/connections/mysql/connection.rb +10 -0
  117. data/test/db/connections/sqlite/connection.rb +8 -0
  118. data/test/db/migrate/001_create_books.rb +15 -0
  119. data/test/db/migrate/002_create_movies.rb +12 -0
  120. data/test/db/migrate/003_create_categories.rb +11 -0
  121. data/test/db/migrate/004_create_electronics.rb +16 -0
  122. data/test/db/migrate/005_create_authors.rb +12 -0
  123. data/test/db/migrate/006_create_postings.rb +9 -0
  124. data/test/db/migrate/007_create_posts.rb +13 -0
  125. data/test/db/migrate/008_create_gadgets.rb +11 -0
  126. data/test/fixtures/authors.yml +9 -0
  127. data/test/fixtures/books.yml +13 -0
  128. data/test/fixtures/categories.yml +7 -0
  129. data/test/fixtures/db_definitions/mysql.sql +41 -0
  130. data/test/fixtures/electronics.yml +49 -0
  131. data/test/fixtures/movies.yml +9 -0
  132. data/test/fixtures/postings.yml +10 -0
  133. data/test/functional/acts_as_solr_test.rb +413 -0
  134. data/test/functional/association_indexing_test.rb +37 -0
  135. data/test/functional/faceted_search_test.rb +163 -0
  136. data/test/functional/multi_solr_search_test.rb +57 -0
  137. data/test/models/author.rb +10 -0
  138. data/test/models/book.rb +10 -0
  139. data/test/models/category.rb +8 -0
  140. data/test/models/electronic.rb +25 -0
  141. data/test/models/gadget.rb +9 -0
  142. data/test/models/movie.rb +17 -0
  143. data/test/models/novel.rb +2 -0
  144. data/test/models/post.rb +3 -0
  145. data/test/models/posting.rb +11 -0
  146. data/test/test_helper.rb +54 -0
  147. data/test/unit/acts_methods_shoulda.rb +68 -0
  148. data/test/unit/class_methods_shoulda.rb +85 -0
  149. data/test/unit/common_methods_shoulda.rb +111 -0
  150. data/test/unit/instance_methods_shoulda.rb +318 -0
  151. data/test/unit/lazy_document_shoulda.rb +34 -0
  152. data/test/unit/parser_instance.rb +19 -0
  153. data/test/unit/parser_methods_shoulda.rb +268 -0
  154. data/test/unit/solr_instance.rb +49 -0
  155. data/test/unit/test_helper.rb +24 -0
  156. metadata +241 -0
@@ -0,0 +1,239 @@
1
+
2
+ == CHANGE_LOG
3
+ === Development
4
+ <b>NEW</b>:: Return an empty SearchResult, rather than nil, when the query returns nothing.
5
+ <b>NEW</b>:: Better error message for parse errors.
6
+ <b>NEW</b>:: Using ENV['RAILS_ENV'] instead of RAILS_ENV, so multiple test environments are supported.
7
+ <b>FIX</b>:: Fixed load path collisions
8
+ <b>NEW</b>:: Gemified acts_as_solr
9
+ <b>NEW</b>:: A unit test suite based on Shoulda, not requiring a running Solr or a Rails environment. (Mathias Meyer)
10
+ <b>NEW</b>:: Added the :offline option to the acts_as_solr method. (Mathias Meyer)
11
+ <b>NEW</b>:: Added :lazy flag to find_by_solr, and with that support to load records lazily. (Mathias Meyer)
12
+ <b>FIX</b>:: Added test: to solr.yml so you don't need to do this by hand. (Ken Harris)
13
+ <b>FIX</b>:: Updated bundled Solr to 1.3. (Mathias Meyer)
14
+ <b>FIX</b>:: Updated bundled solr-ruby to 0.0.6 which comes bundled with Solr 1.3. (Mathias Meyer)
15
+ <b>FIX</b>:: Improved logging of the reindex rake task. (David Stevenson)
16
+ <b>FIX</b>:: Added requirement for libxml-ruby > 0.7, if libxml-ruby is installed. (David Stevenson)
17
+ <b>FIX</b>:: Ruby 1.9 compatibility fixes. (David Palm)
18
+ <b>FIX</b>:: Fixed compatibility with Desert by renaming environment.rb to solr_environment.rb. (David Stevenson)
19
+ <b>FIX</b>:: Moved the require of solr_environment only into tasks that need it. (David Stevenson)
20
+ <b>NEW</b>:: Added support to alias fields and includes using the option :as for acts_as_solr. See the RDoc for details. (Nick Hengeveld)
21
+ <b>NEW</b>:: Added support to attach the score to multi search results. (Mathias Meyer)
22
+ <b>NEW</b>:: Added support for facets on date fields. (Curtis Hatter)
23
+
24
+ === 06-18-2007: Version 0.9
25
+ <b>NEW</b>:: Added the option :scores when doing a search. If set to true this will return the score as a 'solr_score' attribute or each one of the instances found
26
+ books = Book.find_by_solr 'ruby OR splinter', :scores => true
27
+ books.records.first.solr_score
28
+ => 1.21321397
29
+ books.records.last.solr_score
30
+ => 0.12321548
31
+
32
+ <b>NEW</b>:: Major change on the way the results returned are accessed.
33
+ books = Book.find_by_solr 'ruby'
34
+ # the above will return a SearchResults class with 4 methods:
35
+ # docs|results|records: will return an array of records found
36
+ #
37
+ # books.records.is_a?(Array)
38
+ # => true
39
+ #
40
+ # total|num_found|total_hits: will return the total number of records found
41
+ #
42
+ # books.total
43
+ # => 2
44
+ #
45
+ # facets: will return the facets when doing a faceted search
46
+ #
47
+ # max_score|highest_score: returns the highest score found
48
+ #
49
+ # books.max_score
50
+ # => 1.3213213
51
+
52
+ <b>NEW</b>:: Integrating acts_as_solr to use solr-ruby as the 'backend'. Integration based on the patch submitted by Erik Hatcher
53
+ <b>NEW</b>:: Re-factoring rebuild_solr_index to allow adds to be done in batch; and if a finder block is given, it will be called to retrieve the items to index. (thanks Daniel E.)
54
+ <b>NEW</b>:: Adding the option to specify the port Solr should start when using rake solr:start
55
+ rake solr:start RAILS_ENV=your_env PORT=XX
56
+
57
+ <b>NEW</b>:: Adding deprecation warning for the :background configuration option. It will no longer be updated.
58
+ <b>NEW</b>:: Adding support for models that use a primary key other than integer
59
+ class Posting < ActiveRecord::Base
60
+ set_primary_key 'guid' #string
61
+ #make sure you set the :primary_key_field => 'pk_s' if you wish to use a string field as the primary key
62
+ acts_as_solr({},{:primary_key_field => 'pk_s'})
63
+ end
64
+
65
+ <b>FIX</b>:: Disabling of storing most fields. Storage isn't useful for acts_as_solr in any field other than the pk and id fields. It just takes up space and time. (thanks Daniel E.)
66
+ <b>FIX</b>:: Re-factoring code submitted by Daniel E.
67
+ <b>NEW</b>:: Adding an :auto_commit option that will only send the commit command to Solr if it is set to true
68
+ class Author < ActiveRecord::Base
69
+ acts_as_solr :auto_commit => false
70
+ end
71
+
72
+ <b>FIX</b>:: Fixing bug on rake's test task
73
+ <b>FIX</b>:: Making acts_as_solr's Post class compatible with Solr 1.2 (thanks Si)
74
+ <b>NEW</b>:: Adding Solr 1.2
75
+ <b>FIX</b>:: Removing Solr 1.1
76
+ <b>NEW</b>:: Adding a conditional :if option to the acts_as_solr call. It behaves the same way ActiveRecord's :if argument option does.
77
+ class Electronic < ActiveRecord::Base
78
+ acts_as_solr :if => proc{|record| record.is_active?}
79
+ end
80
+
81
+ <b>NEW</b>:: Adding fixtures to Solr index when using rake db:fixtures:load
82
+ <b>FIX</b>:: Fixing boost warning messages
83
+ <b>FIX</b>:: Fixing bug when adding a facet to a field that contains boost
84
+ <b>NEW</b>:: Deprecating find_with_facet and combining functionality with find_by_solr
85
+ <b>NEW</b>:: Adding the option to :exclude_fields when indexing a model
86
+ class User < ActiveRecord::Base
87
+ acts_as_solr :exclude_fields => [:password, :login, :credit_card_number]
88
+ end
89
+
90
+ <b>FIX</b>:: Fixing branch bug on older ruby version
91
+ <b>NEW</b>:: Adding boost support for fields and documents being indexed:
92
+ class Electronic < ActiveRecord::Base
93
+ # You can add boosting on a per-field basis or on the entire document
94
+ acts_as_solr :fields => [{:price => {:boost => 5.0}}], :boost => 5.0
95
+ end
96
+
97
+ <b>FIX</b>:: Fixed the acts_as_solr limitation to only accept test|development|production environments.
98
+
99
+ === 05-16-2007: Version 0.8.5
100
+ <b>FIX</b>:: There's no need to specify the :field_types anymore when doing a search in a model that specifies a field type for a field.
101
+ <b>FIX</b>:: Better handling of nil values from indexed fields. Solr complained when indexing fields with field type and the field values being passed as nils.
102
+ <b>NEW</b>:: Adding Solr sort (order by) option to the search query (thanks Kevin Hunt)
103
+ <b>FIX</b>:: Applying patch suggested for increasing the Solr commit speed (thanks Mourad Hammiche)
104
+ <b>FIX</b>:: Updated documentation
105
+
106
+ === 05-10-2007: Version 0.8
107
+ <b>NEW</b>: New video tutorial
108
+ <b>NEW</b>: Faceted search has been implemented and its possible to 'drill-down' on the facets
109
+ <b>NEW</b>: New rake tasks you can use to start/stop the solr server in test, development and production environments: (thanks Matt Clark)
110
+ rake solr:start|stop RAILS_ENV=test|development|production (defaults to development if none given)
111
+
112
+ <b>NEW</b>: Changes to the plugin's test framework and it now supports Sqlite as well (thanks Matt Clark)
113
+ <b>FIX</b>: Patch applied (thanks Micah) that allows one to have multiple solr instances in the same servlet
114
+ <b>FIX</b>: Patch applied (thanks Micah) that allows indexing of STIs
115
+ <b>FIX</b>: Patch applied (thanks Gordon) that allows the plugin to use a table's primary key different than 'id'
116
+ <b>FIX</b>: Returning empty array instead of empty strings when no records are found
117
+ <b>FIX</b>: Problem with unit tests failing due to order of the tests and speed of the commits
118
+
119
+ === 02-16-2007: Version 0.7
120
+ <b>NEW</b>: You can now specify the field types when indexing and searching if
121
+ you'd like to preserve its original type:
122
+
123
+ <b>Indexing</b>
124
+
125
+ Each field passed can also be a hash with the value being a field type
126
+
127
+ class Electronic < ActiveRecord::Base
128
+ acts_as_solr :fields => [{:price => :range_float}, {:current_time => :date}]
129
+ def current_time
130
+ Time.now
131
+ end
132
+ end
133
+
134
+ <b>Searching</b>
135
+ Electronic.find_by_solr "ipod AND price:[* TO 59.99]",
136
+ :field_types => [{:price => :range_float}]
137
+
138
+ The field types accepted are:
139
+ <em>:float</em>:: Index the field value as a float (ie.: 12.87)
140
+ <em>:integer</em>:: Index the field value as an integer (ie.: 31)
141
+ <em>:boolean</em>:: Index the field value as a boolean (ie.: true/false)
142
+ <em>:date</em>:: Index the field value as a date (ie.: Wed Nov 15 23:13:03 PST 2006)
143
+ <em>:string</em>:: Index the field value as a text string, not applying the same indexing filters as a regular text field
144
+ <em>:range_integer</em>:: Index the field value for integer range queries (ie.:[5 TO 20])
145
+ <em>:range_float</em>:: Index the field value for float range queries (ie.:[14.56 TO 19.99])
146
+
147
+ <b>Setting the field type preserves its original type when indexed</b>
148
+
149
+ <b>FIX</b>: Fixing sorting bug. Thanks for the catch Laurel
150
+
151
+ <b>FIX</b>: Fixing small bug when installing the plugin
152
+
153
+ <b>NEW</b>: Adding the :additional_fields option to the acts_as_solr method
154
+
155
+ === 02-05-2007: Version 0.6.5
156
+ <b>NEW</b>:: Added multi-model search, which can be used to execute a search across multiple models:
157
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie]
158
+
159
+ ====options:
160
+ Accepts the same options as find_by_solr plus:
161
+ models:: The additional models you'd like to include in the search
162
+ results_format:: Specify the format of the results found
163
+ :objects :: Will return an array with the results being objects (default). Example:
164
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :objects
165
+ :ids :: Will return an array with the ids of each entry found. Example:
166
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :ids
167
+ => [{"id" => "Movie:1"},{"id" => Book:1}]
168
+ Where the value of each array is as Model:instance_id
169
+
170
+ === 02-03-2007: Version 0.6
171
+ <b>NEW</b>:: Added basic faceted search functionality for indexing and searching:
172
+
173
+ ==== Indexing:
174
+
175
+ class Electronic < ActiveRecord::Base
176
+ acts_as_solr :facets => [:category, :manufacturer]
177
+ end
178
+
179
+ ==== Searching:
180
+
181
+ Electronic.find_with_facet "memory", :facets => {:fields =>[:category]}
182
+
183
+ === 01-15-2007: Version 0.5
184
+ <b>NEW</b>:: Added model association indexing, which means you can include any :has_one, :has_many,
185
+ :belongs_to and :has_and_belongs_to_many association to be indexed:
186
+
187
+ class Category < ActiveRecord::Base
188
+ has_many :books
189
+ acts_as_solr :include => [:books]
190
+ end
191
+
192
+ class Book < ActiveRecord::Base
193
+ belongs_to :category
194
+ acts_as_solr :include => [:category]
195
+ end
196
+
197
+ === 01-11-2007:
198
+ <b>NEW</b>:: Added the acts_as_solr's plugin tests
199
+
200
+ === 11-07-2006: Version 0.4
201
+ <b>NEW</b>:: Added :background option, which takes and integer value (in minutes) to wait before committing the changes to Solr. This depends on rail_cron being installed. By setting up the background job we prevent the users from having to wait for Solr records to be created, and we keep from updating the index over and over for quickly successive changes. (Rob Kaufman)
202
+
203
+ === 11-02-2006: Version 0.3
204
+ <b>NEW</b>:: Added a method (Model.count_by_solr) that returns the total number of documents found based on query passed
205
+ <b>NEW</b>:: Added configuration for production and development environments
206
+
207
+ === 10-21-2006: Version 0.2
208
+ <b>PLUGIN</b>
209
+ <b>FIX</b>:: Fixed bug when mixing search-by-field and 'free' search: Model.find_by_solr 'solr AND name:Thiago'
210
+ <b>FIX</b>:: Fixed bug with multi-terms search: Book.find_by_solr 'anteater john'
211
+ <b>FIX</b>:: Fixed bug when including more than one search field: Model.find_by_solr 'name:Thiago AND engine:Solr'
212
+ <b>FIX</b>:: Fixed bug when rebuilding the index, it wasn't saving the data
213
+ <b>NEW</b>:: Added the ability to index custom methods from a model as search fields
214
+ <b>NEW</b>:: Added a search method (Model.find_id_by_solr) that will return only the id of the results
215
+
216
+ <b>SCHEMA.XML</b>
217
+ <b>NEW</b>:: Added a new field: <field name="default" type="text" indexed="true" stored="true" />
218
+ <b>NEW</b>:: Added a default search field: <defaultSearchField>default</defaultSearchField>
219
+ <b>FIX</b>:: Changed the defaultOperator to AND instead of OR
220
+
221
+ === 09-29-2006: Version 0.1
222
+ <b>PLUGIN</b>
223
+ <b>NEW</b>:: Included the option of having a Solr config file inside the rails env.
224
+ <b>NEW</b>:: Added the ability of indexing only certain fields, if you chose to.
225
+ <b>NEW</b>:: Added configuration options
226
+ <b>NEW</b>:: Changed the way the search was done:
227
+ Old: You were forced the specify the field you wanted to look for
228
+ ('field:value') and you had to specify a default search field as
229
+ well, for when you didn't include the 'field' in the search term
230
+ New: The new search features include:
231
+ - You don't have to specify a default search field;
232
+ - You are not forced to include the field name in the search term,
233
+ unless you choose to search for a specific field ('name:Thiago');
234
+ - You can pass the starting row and the number of rows per page,
235
+ which is usefull for pagination
236
+ <b>NEW</b>:: Included a method to rebuild the index files
237
+
238
+ <b>SCHEMA.XML</b>
239
+ <b>NEW</b>:: Created an optimized version of the config file to better work with this plugin
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2006 Erik Hatcher, Thiago Jackiw
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,118 @@
1
+ `acts_as_solr` Rails plugin
2
+ ======
3
+ This plugin adds full text search capabilities and many other nifty features from Apache's [Solr](http://lucene.apache.org/solr/) to any Rails model.
4
+ It was based on the first draft by Erik Hatcher.
5
+
6
+ Current Release
7
+ ======
8
+ The current stable release is v0.9 and was released on 06-18-2007.
9
+
10
+ Changes
11
+ ======
12
+ Please refer to the CHANGE_LOG
13
+
14
+ Installation
15
+ ======
16
+
17
+ For Rails >= 2.1:
18
+
19
+ script/plugin install git://github.com/mattmatt/acts_as_solr.git
20
+
21
+ For Rails < 2.1:
22
+
23
+ cd vendor/plugins
24
+ git clone git://github.com/mattmatt/acts_as_solr.git
25
+ rm -rf acts_as_solr/.git
26
+
27
+ Make sure you copy `vendor/plugins/acts_as_solr/config/solr.yml` to your Rails
28
+ application's config directory, when you install via `git clone`.
29
+
30
+ Here is an example solr.yml configuration:
31
+
32
+ <pre><code>
33
+ # Config file for the acts_as_solr plugin.
34
+ #
35
+ # If you change the host or port number here, make sure you update
36
+ # them in your Solr config file
37
+
38
+ development:
39
+ url: http://127.0.0.1:8982/solr
40
+
41
+ production:
42
+ url: http://127.0.0.1:8983/solr
43
+ jvm_options: -server -d64 -Xmx1024M -Xms64M
44
+
45
+ test:
46
+ url: http://127.0.0.1:8981/solr
47
+ </code></pre>
48
+
49
+ Requirements
50
+ ------
51
+ * Java Runtime Environment(JRE) 1.5 aka 5.0 [http://www.java.com/en/download/index.jsp](http://www.java.com/en/download/index.jsp)
52
+ * If you have libxml-ruby installed, make sure it's at least version 0.7
53
+
54
+ Configuration
55
+ ======
56
+ If you are using acts_as_solr as a Rails plugin, everything is configured to work out of the box. You can use `rake solr:start` and `rake solr:stop`
57
+ to start and stop the Solr web server (an embedded Jetty). If the default JVM options aren't suitable for
58
+ your environment, you can configure them in solr.yml with the option `jvm_options`. There is a default
59
+ set for the production environment to have some more memory available for the JVM than the defaults, but
60
+ feel free to change them to your liking.
61
+
62
+ If you are using acts_as_solr as a gem, create a file named lib/tasks/acts_as_solr.rake:
63
+ <pre><code>
64
+ require "acts_as_solr/tasks"
65
+ </code></pre>
66
+
67
+ Basic Usage
68
+ ======
69
+ <pre><code>
70
+ # Just include the line below to any of your ActiveRecord models:
71
+ acts_as_solr
72
+
73
+ # Or if you want, you can specify only the fields that should be indexed:
74
+ acts_as_solr :fields => [:name, :author]
75
+
76
+ # Then to find instances of your model, just do:
77
+ Model.find_by_solr(query) #query is a string representing your query
78
+
79
+ # Please see ActsAsSolr::ActsMethods for a complete info
80
+
81
+ </code></pre>
82
+
83
+
84
+ `acts_as_solr` in your tests
85
+ ======
86
+ To test code that uses `acts_as_solr` you must start a Solr server for the test environment. You can do that with `rake solr:start RAILS_ENV=test`
87
+
88
+ However, if you would like to mock out Solr calls so that a Solr server is not needed (and your tests will run much faster), just add this to your `test_helper.rb` or similar:
89
+
90
+ <pre><code>
91
+ class ActsAsSolr::Post
92
+ def self.execute(request)
93
+ true
94
+ end
95
+ end
96
+ </pre></code>
97
+
98
+ ([via](http://www.subelsky.com/2007/10/actsassolr-capistranhttpwwwbloggercomim.html#c1646308013209805416))
99
+
100
+ Authors
101
+ ======
102
+ Erik Hatcher: First draft<br>
103
+ Thiago Jackiw: Previous developer<br>
104
+ Luke Francl: Current developer<br>
105
+ Mathias Meyer: Current developer<br>
106
+
107
+ Support
108
+ =======
109
+
110
+ Check the [project website](http://mattmatt.github.com/acts_as_solr) or stop by the [Google Group](http://groups.google.com/group/acts_as_solr). Send bug reports through [GitHub Issues](http://github.com/mattmatt/acts_as_solr/issues).
111
+
112
+ Release Information
113
+ ======
114
+ Released under the MIT license.
115
+
116
+ More info
117
+ ======
118
+ The old [acts_as_solr homepage](http://acts-as-solr.railsfreaks.com) is no more. For more up-to-date information, check out the project page of the current mainline on [GitHub](http://github.com/mattmatt/acts_as_solr/wikis).
@@ -0,0 +1,107 @@
1
+ = acts_as_solr Rails plugin
2
+
3
+ This plugin adds full text search capabilities and many other nifty features from Apache's Solr[http://lucene.apache.org/solr/] to any Rails model.
4
+ It was based on the first draft by Erik Hatcher.
5
+
6
+ == Current Release
7
+
8
+ There is no numbered release yet, but the master branch is always considered stable.
9
+
10
+ == Support
11
+
12
+ Check the project website[http://mattmatt.github.com/acts_as_solr] or stop by the Google Group[http://groups.google.com/group/acts_as_solr]. Send bug reports through GitHub[http://github.com/mattmatt/acts_as_solr/issues].
13
+
14
+ == Changes
15
+
16
+ Please refer to the CHANGELOG[http://github.com/mattmatt/acts_as_solr/blob/master/CHANGE_LOG]
17
+
18
+ == Installation
19
+
20
+ For Rails >= 2.1:
21
+
22
+ script/plugin install git://github.com/mattmatt/acts_as_solr.git
23
+
24
+ For Rails < 2.1:
25
+
26
+ cd vendor/plugins
27
+ git clone git://github.com/mattmatt/acts_as_solr.git
28
+ rm -rf acts_as_solr/.git
29
+
30
+ Make sure you copy vendor/plugins/acts_as_solr/config/solr.yml to your Rails
31
+ application's config directory, when you install via git clone.
32
+
33
+ Here is an example solr.yml configuration:
34
+
35
+ # Config file for the acts_as_solr plugin.
36
+ #
37
+ # If you change the host or port number here, make sure you update
38
+ # them in your Solr config file
39
+
40
+ development:
41
+ url: http://127.0.0.1:8982/solr
42
+
43
+ production:
44
+ url: http://127.0.0.1:8983/solr
45
+ jvm_options: -server -d64 -Xmx1024M -Xms64M
46
+
47
+ test:
48
+ url: http://127.0.0.1:8981/solr
49
+
50
+
51
+ == Requirements
52
+
53
+ * Java Runtime Environment(JRE) 1.5 aka 5.0 [http://www.java.com/en/download/index.jsp](http://www.java.com/en/download/index.jsp)
54
+ * If you have libxml-ruby installed, make sure it's at least version 0.7
55
+
56
+ == Configuration
57
+
58
+ If you are using acts_as_solr as a Rails plugin, everything is configured to work out of the box. You can use `rake solr:start` and `rake solr:stop`
59
+ to start and stop the Solr web server (an embedded Jetty). If the default JVM options aren't suitable for
60
+ your environment, you can configure them in solr.yml with the option `jvm_options`. There is a default
61
+ set for the production environment to have some more memory available for the JVM than the defaults, but
62
+ feel free to change them to your liking.
63
+
64
+ If you are using acts_as_solr as a gem, create a file named lib/tasks/acts_as_solr.rake:
65
+
66
+ require "acts_as_solr/tasks"
67
+
68
+
69
+ == Basic Usage
70
+
71
+ # Just include the line below to any of your ActiveRecord models:
72
+ acts_as_solr
73
+
74
+ # Or if you want, you can specify only the fields that should be indexed:
75
+ acts_as_solr :fields => [:name, :author]
76
+
77
+ # Then to find instances of your model, just do:
78
+ Model.find_by_solr(query) #query is a string representing your query
79
+
80
+ # Please see ActsAsSolr::ActsMethods for a complete info
81
+
82
+ == acts_as_solr in your tests
83
+
84
+ To test code that uses acts_as_solr you must start a Solr server for the test environment. You can do that with
85
+
86
+ rake solr:start RAILS_ENV=test
87
+
88
+ However, if you would like to mock out Solr calls so that a Solr server is not needed (and your tests will run much faster), just add this to your `test_helper.rb` or similar:
89
+
90
+ class ActsAsSolr::Post
91
+ def self.execute(request)
92
+ true
93
+ end
94
+ end
95
+
96
+ (via[http://www.subelsky.com/2007/10/actsassolr-capistranhttpwwwbloggercomim.html#c1646308013209805416])
97
+
98
+ == Authors
99
+
100
+ Erik Hatcher: First draft
101
+ Thiago Jackiw: Previous developer
102
+ Luke Francl: Current developer
103
+ Mathias Meyer: Current developer
104
+
105
+ == Release Information
106
+
107
+ Released under the MIT license.