honkster-acts_as_solr 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/CHANGE_LOG +233 -0
  2. data/LICENSE +19 -0
  3. data/README.markdown +118 -0
  4. data/README.rdoc +107 -0
  5. data/Rakefile +68 -0
  6. data/TESTING_THE_PLUGIN +25 -0
  7. data/VERSION +1 -0
  8. data/lib/acts_as_solr/acts_methods.rb +279 -0
  9. data/lib/acts_as_solr/class_methods.rb +236 -0
  10. data/lib/acts_as_solr/common_methods.rb +89 -0
  11. data/lib/acts_as_solr/deprecation.rb +61 -0
  12. data/lib/acts_as_solr/instance_methods.rb +166 -0
  13. data/lib/acts_as_solr/lazy_document.rb +18 -0
  14. data/lib/acts_as_solr/parser_methods.rb +201 -0
  15. data/lib/acts_as_solr/search_results.rb +68 -0
  16. data/lib/acts_as_solr/solr_fixtures.rb +13 -0
  17. data/lib/acts_as_solr/tasks/database.rake +16 -0
  18. data/lib/acts_as_solr/tasks/solr.rake +132 -0
  19. data/lib/acts_as_solr/tasks/test.rake +5 -0
  20. data/lib/acts_as_solr/tasks.rb +10 -0
  21. data/lib/acts_as_solr.rb +64 -0
  22. data/lib/solr/connection.rb +177 -0
  23. data/lib/solr/document.rb +75 -0
  24. data/lib/solr/exception.rb +13 -0
  25. data/lib/solr/field.rb +36 -0
  26. data/lib/solr/importer/array_mapper.rb +26 -0
  27. data/lib/solr/importer/delimited_file_source.rb +38 -0
  28. data/lib/solr/importer/hpricot_mapper.rb +27 -0
  29. data/lib/solr/importer/mapper.rb +51 -0
  30. data/lib/solr/importer/solr_source.rb +41 -0
  31. data/lib/solr/importer/xpath_mapper.rb +35 -0
  32. data/lib/solr/importer.rb +19 -0
  33. data/lib/solr/indexer.rb +52 -0
  34. data/lib/solr/request/add_document.rb +58 -0
  35. data/lib/solr/request/base.rb +36 -0
  36. data/lib/solr/request/commit.rb +29 -0
  37. data/lib/solr/request/delete.rb +48 -0
  38. data/lib/solr/request/dismax.rb +46 -0
  39. data/lib/solr/request/index_info.rb +22 -0
  40. data/lib/solr/request/modify_document.rb +46 -0
  41. data/lib/solr/request/optimize.rb +19 -0
  42. data/lib/solr/request/ping.rb +36 -0
  43. data/lib/solr/request/select.rb +54 -0
  44. data/lib/solr/request/spellcheck.rb +30 -0
  45. data/lib/solr/request/standard.rb +402 -0
  46. data/lib/solr/request/update.rb +23 -0
  47. data/lib/solr/request.rb +26 -0
  48. data/lib/solr/response/add_document.rb +17 -0
  49. data/lib/solr/response/base.rb +42 -0
  50. data/lib/solr/response/commit.rb +15 -0
  51. data/lib/solr/response/delete.rb +13 -0
  52. data/lib/solr/response/dismax.rb +8 -0
  53. data/lib/solr/response/index_info.rb +26 -0
  54. data/lib/solr/response/modify_document.rb +17 -0
  55. data/lib/solr/response/optimize.rb +14 -0
  56. data/lib/solr/response/ping.rb +26 -0
  57. data/lib/solr/response/ruby.rb +42 -0
  58. data/lib/solr/response/select.rb +17 -0
  59. data/lib/solr/response/spellcheck.rb +20 -0
  60. data/lib/solr/response/standard.rb +60 -0
  61. data/lib/solr/response/xml.rb +39 -0
  62. data/lib/solr/response.rb +27 -0
  63. data/lib/solr/solrtasks.rb +27 -0
  64. data/lib/solr/util.rb +32 -0
  65. data/lib/solr/xml.rb +44 -0
  66. data/lib/solr.rb +26 -0
  67. data/solr/CHANGES.txt +1207 -0
  68. data/solr/LICENSE.txt +712 -0
  69. data/solr/NOTICE.txt +90 -0
  70. data/solr/etc/jetty.xml +205 -0
  71. data/solr/etc/webdefault.xml +379 -0
  72. data/solr/lib/easymock.jar +0 -0
  73. data/solr/lib/jetty-6.1.3.jar +0 -0
  74. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  75. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  76. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  77. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  78. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  79. data/solr/lib/servlet-api-2.4.jar +0 -0
  80. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  81. data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
  82. data/solr/solr/README.txt +52 -0
  83. data/solr/solr/bin/abc +176 -0
  84. data/solr/solr/bin/abo +176 -0
  85. data/solr/solr/bin/backup +108 -0
  86. data/solr/solr/bin/backupcleaner +142 -0
  87. data/solr/solr/bin/commit +128 -0
  88. data/solr/solr/bin/optimize +129 -0
  89. data/solr/solr/bin/readercycle +129 -0
  90. data/solr/solr/bin/rsyncd-disable +77 -0
  91. data/solr/solr/bin/rsyncd-enable +76 -0
  92. data/solr/solr/bin/rsyncd-start +145 -0
  93. data/solr/solr/bin/rsyncd-stop +105 -0
  94. data/solr/solr/bin/scripts-util +83 -0
  95. data/solr/solr/bin/snapcleaner +148 -0
  96. data/solr/solr/bin/snapinstaller +168 -0
  97. data/solr/solr/bin/snappuller +248 -0
  98. data/solr/solr/bin/snappuller-disable +77 -0
  99. data/solr/solr/bin/snappuller-enable +77 -0
  100. data/solr/solr/bin/snapshooter +109 -0
  101. data/solr/solr/conf/admin-extra.html +31 -0
  102. data/solr/solr/conf/protwords.txt +21 -0
  103. data/solr/solr/conf/schema.xml +126 -0
  104. data/solr/solr/conf/scripts.conf +24 -0
  105. data/solr/solr/conf/solrconfig.xml +458 -0
  106. data/solr/solr/conf/stopwords.txt +57 -0
  107. data/solr/solr/conf/synonyms.txt +31 -0
  108. data/solr/solr/conf/xslt/example.xsl +132 -0
  109. data/solr/solr/conf/xslt/example_atom.xsl +63 -0
  110. data/solr/solr/conf/xslt/example_rss.xsl +62 -0
  111. data/solr/start.jar +0 -0
  112. data/solr/webapps/solr.war +0 -0
  113. data/test/config/solr.yml +2 -0
  114. data/test/db/connections/mysql/connection.rb +10 -0
  115. data/test/db/connections/sqlite/connection.rb +8 -0
  116. data/test/db/migrate/001_create_books.rb +15 -0
  117. data/test/db/migrate/002_create_movies.rb +12 -0
  118. data/test/db/migrate/003_create_categories.rb +11 -0
  119. data/test/db/migrate/004_create_electronics.rb +16 -0
  120. data/test/db/migrate/005_create_authors.rb +12 -0
  121. data/test/db/migrate/006_create_postings.rb +9 -0
  122. data/test/db/migrate/007_create_posts.rb +13 -0
  123. data/test/db/migrate/008_create_gadgets.rb +11 -0
  124. data/test/fixtures/authors.yml +9 -0
  125. data/test/fixtures/books.yml +13 -0
  126. data/test/fixtures/categories.yml +7 -0
  127. data/test/fixtures/db_definitions/mysql.sql +41 -0
  128. data/test/fixtures/electronics.yml +49 -0
  129. data/test/fixtures/movies.yml +9 -0
  130. data/test/fixtures/postings.yml +10 -0
  131. data/test/functional/acts_as_solr_test.rb +413 -0
  132. data/test/functional/association_indexing_test.rb +37 -0
  133. data/test/functional/faceted_search_test.rb +163 -0
  134. data/test/functional/multi_solr_search_test.rb +51 -0
  135. data/test/models/author.rb +10 -0
  136. data/test/models/book.rb +10 -0
  137. data/test/models/category.rb +8 -0
  138. data/test/models/electronic.rb +21 -0
  139. data/test/models/gadget.rb +9 -0
  140. data/test/models/movie.rb +17 -0
  141. data/test/models/novel.rb +2 -0
  142. data/test/models/post.rb +3 -0
  143. data/test/models/posting.rb +11 -0
  144. data/test/test_helper.rb +51 -0
  145. data/test/unit/acts_methods_shoulda.rb +68 -0
  146. data/test/unit/class_methods_shoulda.rb +85 -0
  147. data/test/unit/common_methods_shoulda.rb +111 -0
  148. data/test/unit/instance_methods_shoulda.rb +318 -0
  149. data/test/unit/lazy_document_shoulda.rb +34 -0
  150. data/test/unit/parser_instance.rb +19 -0
  151. data/test/unit/parser_methods_shoulda.rb +268 -0
  152. data/test/unit/solr_instance.rb +44 -0
  153. data/test/unit/test_helper.rb +22 -0
  154. metadata +239 -0
data/CHANGE_LOG ADDED
@@ -0,0 +1,233 @@
1
+ == CHANGE_LOG
2
+ === Development
3
+ <b>NEW</b>:: A unit test suite based on Shoulda, not requiring a running Solr or a Rails environment. (Mathias Meyer)
4
+ <b>NEW</b>:: Added the :offline option to the acts_as_solr method. (Mathias Meyer)
5
+ <b>NEW</b>:: Added :lazy flag to find_by_solr, and with that support to load records lazily. (Mathias Meyer)
6
+ <b>FIX</b>:: Added test: to solr.yml so you don't need to do this by hand. (Ken Harris)
7
+ <b>FIX</b>:: Updated bundled Solr to 1.3. (Mathias Meyer)
8
+ <b>FIX</b>:: Updated bundled solr-ruby to 0.0.6 which comes bundled with Solr 1.3. (Mathias Meyer)
9
+ <b>FIX</b>:: Improved logging of the reindex rake task. (David Stevenson)
10
+ <b>FIX</b>:: Added requirement for libxml-ruby > 0.7, if libxml-ruby is installed. (David Stevenson)
11
+ <b>FIX</b>:: Ruby 1.9 compatibility fixes. (David Palm)
12
+ <b>FIX</b>:: Fixed compatibility with Desert by renaming environment.rb to solr_environment.rb. (David Stevenson)
13
+ <b>FIX</b>:: Moved the require of solr_environment only into tasks that need it. (David Stevenson)
14
+ <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)
15
+ <b>NEW</b>:: Added support to attach the score to multi search results. (Mathias Meyer)
16
+ <b>NEW</b>:: Added support for facets on date fields. (Curtis Hatter)
17
+
18
+ === 06-18-2007: Version 0.9
19
+ <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
20
+ books = Book.find_by_solr 'ruby OR splinter', :scores => true
21
+ books.records.first.solr_score
22
+ => 1.21321397
23
+ books.records.last.solr_score
24
+ => 0.12321548
25
+
26
+ <b>NEW</b>:: Major change on the way the results returned are accessed.
27
+ books = Book.find_by_solr 'ruby'
28
+ # the above will return a SearchResults class with 4 methods:
29
+ # docs|results|records: will return an array of records found
30
+ #
31
+ # books.records.is_a?(Array)
32
+ # => true
33
+ #
34
+ # total|num_found|total_hits: will return the total number of records found
35
+ #
36
+ # books.total
37
+ # => 2
38
+ #
39
+ # facets: will return the facets when doing a faceted search
40
+ #
41
+ # max_score|highest_score: returns the highest score found
42
+ #
43
+ # books.max_score
44
+ # => 1.3213213
45
+
46
+ <b>NEW</b>:: Integrating acts_as_solr to use solr-ruby as the 'backend'. Integration based on the patch submitted by Erik Hatcher
47
+ <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.)
48
+ <b>NEW</b>:: Adding the option to specify the port Solr should start when using rake solr:start
49
+ rake solr:start RAILS_ENV=your_env PORT=XX
50
+
51
+ <b>NEW</b>:: Adding deprecation warning for the :background configuration option. It will no longer be updated.
52
+ <b>NEW</b>:: Adding support for models that use a primary key other than integer
53
+ class Posting < ActiveRecord::Base
54
+ set_primary_key 'guid' #string
55
+ #make sure you set the :primary_key_field => 'pk_s' if you wish to use a string field as the primary key
56
+ acts_as_solr({},{:primary_key_field => 'pk_s'})
57
+ end
58
+
59
+ <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.)
60
+ <b>FIX</b>:: Re-factoring code submitted by Daniel E.
61
+ <b>NEW</b>:: Adding an :auto_commit option that will only send the commit command to Solr if it is set to true
62
+ class Author < ActiveRecord::Base
63
+ acts_as_solr :auto_commit => false
64
+ end
65
+
66
+ <b>FIX</b>:: Fixing bug on rake's test task
67
+ <b>FIX</b>:: Making acts_as_solr's Post class compatible with Solr 1.2 (thanks Si)
68
+ <b>NEW</b>:: Adding Solr 1.2
69
+ <b>FIX</b>:: Removing Solr 1.1
70
+ <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.
71
+ class Electronic < ActiveRecord::Base
72
+ acts_as_solr :if => proc{|record| record.is_active?}
73
+ end
74
+
75
+ <b>NEW</b>:: Adding fixtures to Solr index when using rake db:fixtures:load
76
+ <b>FIX</b>:: Fixing boost warning messages
77
+ <b>FIX</b>:: Fixing bug when adding a facet to a field that contains boost
78
+ <b>NEW</b>:: Deprecating find_with_facet and combining functionality with find_by_solr
79
+ <b>NEW</b>:: Adding the option to :exclude_fields when indexing a model
80
+ class User < ActiveRecord::Base
81
+ acts_as_solr :exclude_fields => [:password, :login, :credit_card_number]
82
+ end
83
+
84
+ <b>FIX</b>:: Fixing branch bug on older ruby version
85
+ <b>NEW</b>:: Adding boost support for fields and documents being indexed:
86
+ class Electronic < ActiveRecord::Base
87
+ # You can add boosting on a per-field basis or on the entire document
88
+ acts_as_solr :fields => [{:price => {:boost => 5.0}}], :boost => 5.0
89
+ end
90
+
91
+ <b>FIX</b>:: Fixed the acts_as_solr limitation to only accept test|development|production environments.
92
+
93
+ === 05-16-2007: Version 0.8.5
94
+ <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.
95
+ <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.
96
+ <b>NEW</b>:: Adding Solr sort (order by) option to the search query (thanks Kevin Hunt)
97
+ <b>FIX</b>:: Applying patch suggested for increasing the Solr commit speed (thanks Mourad Hammiche)
98
+ <b>FIX</b>:: Updated documentation
99
+
100
+ === 05-10-2007: Version 0.8
101
+ <b>NEW</b>: New video tutorial
102
+ <b>NEW</b>: Faceted search has been implemented and its possible to 'drill-down' on the facets
103
+ <b>NEW</b>: New rake tasks you can use to start/stop the solr server in test, development and production environments: (thanks Matt Clark)
104
+ rake solr:start|stop RAILS_ENV=test|development|production (defaults to development if none given)
105
+
106
+ <b>NEW</b>: Changes to the plugin's test framework and it now supports Sqlite as well (thanks Matt Clark)
107
+ <b>FIX</b>: Patch applied (thanks Micah) that allows one to have multiple solr instances in the same servlet
108
+ <b>FIX</b>: Patch applied (thanks Micah) that allows indexing of STIs
109
+ <b>FIX</b>: Patch applied (thanks Gordon) that allows the plugin to use a table's primary key different than 'id'
110
+ <b>FIX</b>: Returning empty array instead of empty strings when no records are found
111
+ <b>FIX</b>: Problem with unit tests failing due to order of the tests and speed of the commits
112
+
113
+ === 02-16-2007: Version 0.7
114
+ <b>NEW</b>: You can now specify the field types when indexing and searching if
115
+ you'd like to preserve its original type:
116
+
117
+ <b>Indexing</b>
118
+
119
+ Each field passed can also be a hash with the value being a field type
120
+
121
+ class Electronic < ActiveRecord::Base
122
+ acts_as_solr :fields => [{:price => :range_float}, {:current_time => :date}]
123
+ def current_time
124
+ Time.now
125
+ end
126
+ end
127
+
128
+ <b>Searching</b>
129
+ Electronic.find_by_solr "ipod AND price:[* TO 59.99]",
130
+ :field_types => [{:price => :range_float}]
131
+
132
+ The field types accepted are:
133
+ <em>:float</em>:: Index the field value as a float (ie.: 12.87)
134
+ <em>:integer</em>:: Index the field value as an integer (ie.: 31)
135
+ <em>:boolean</em>:: Index the field value as a boolean (ie.: true/false)
136
+ <em>:date</em>:: Index the field value as a date (ie.: Wed Nov 15 23:13:03 PST 2006)
137
+ <em>:string</em>:: Index the field value as a text string, not applying the same indexing filters as a regular text field
138
+ <em>:range_integer</em>:: Index the field value for integer range queries (ie.:[5 TO 20])
139
+ <em>:range_float</em>:: Index the field value for float range queries (ie.:[14.56 TO 19.99])
140
+
141
+ <b>Setting the field type preserves its original type when indexed</b>
142
+
143
+ <b>FIX</b>: Fixing sorting bug. Thanks for the catch Laurel
144
+
145
+ <b>FIX</b>: Fixing small bug when installing the plugin
146
+
147
+ <b>NEW</b>: Adding the :additional_fields option to the acts_as_solr method
148
+
149
+ === 02-05-2007: Version 0.6.5
150
+ <b>NEW</b>:: Added multi-model search, which can be used to execute a search across multiple models:
151
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie]
152
+
153
+ ====options:
154
+ Accepts the same options as find_by_solr plus:
155
+ models:: The additional models you'd like to include in the search
156
+ results_format:: Specify the format of the results found
157
+ :objects :: Will return an array with the results being objects (default). Example:
158
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :objects
159
+ :ids :: Will return an array with the ids of each entry found. Example:
160
+ Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :ids
161
+ => [{"id" => "Movie:1"},{"id" => Book:1}]
162
+ Where the value of each array is as Model:instance_id
163
+
164
+ === 02-03-2007: Version 0.6
165
+ <b>NEW</b>:: Added basic faceted search functionality for indexing and searching:
166
+
167
+ ==== Indexing:
168
+
169
+ class Electronic < ActiveRecord::Base
170
+ acts_as_solr :facets => [:category, :manufacturer]
171
+ end
172
+
173
+ ==== Searching:
174
+
175
+ Electronic.find_with_facet "memory", :facets => {:fields =>[:category]}
176
+
177
+ === 01-15-2007: Version 0.5
178
+ <b>NEW</b>:: Added model association indexing, which means you can include any :has_one, :has_many,
179
+ :belongs_to and :has_and_belongs_to_many association to be indexed:
180
+
181
+ class Category < ActiveRecord::Base
182
+ has_many :books
183
+ acts_as_solr :include => [:books]
184
+ end
185
+
186
+ class Book < ActiveRecord::Base
187
+ belongs_to :category
188
+ acts_as_solr :include => [:category]
189
+ end
190
+
191
+ === 01-11-2007:
192
+ <b>NEW</b>:: Added the acts_as_solr's plugin tests
193
+
194
+ === 11-07-2006: Version 0.4
195
+ <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)
196
+
197
+ === 11-02-2006: Version 0.3
198
+ <b>NEW</b>:: Added a method (Model.count_by_solr) that returns the total number of documents found based on query passed
199
+ <b>NEW</b>:: Added configuration for production and development environments
200
+
201
+ === 10-21-2006: Version 0.2
202
+ <b>PLUGIN</b>
203
+ <b>FIX</b>:: Fixed bug when mixing search-by-field and 'free' search: Model.find_by_solr 'solr AND name:Thiago'
204
+ <b>FIX</b>:: Fixed bug with multi-terms search: Book.find_by_solr 'anteater john'
205
+ <b>FIX</b>:: Fixed bug when including more than one search field: Model.find_by_solr 'name:Thiago AND engine:Solr'
206
+ <b>FIX</b>:: Fixed bug when rebuilding the index, it wasn't saving the data
207
+ <b>NEW</b>:: Added the ability to index custom methods from a model as search fields
208
+ <b>NEW</b>:: Added a search method (Model.find_id_by_solr) that will return only the id of the results
209
+
210
+ <b>SCHEMA.XML</b>
211
+ <b>NEW</b>:: Added a new field: <field name="default" type="text" indexed="true" stored="true" />
212
+ <b>NEW</b>:: Added a default search field: <defaultSearchField>default</defaultSearchField>
213
+ <b>FIX</b>:: Changed the defaultOperator to AND instead of OR
214
+
215
+ === 09-29-2006: Version 0.1
216
+ <b>PLUGIN</b>
217
+ <b>NEW</b>:: Included the option of having a Solr config file inside the rails env.
218
+ <b>NEW</b>:: Added the ability of indexing only certain fields, if you chose to.
219
+ <b>NEW</b>:: Added configuration options
220
+ <b>NEW</b>:: Changed the way the search was done:
221
+ Old: You were forced the specify the field you wanted to look for
222
+ ('field:value') and you had to specify a default search field as
223
+ well, for when you didn't include the 'field' in the search term
224
+ New: The new search features include:
225
+ - You don't have to specify a default search field;
226
+ - You are not forced to include the field name in the search term,
227
+ unless you choose to search for a specific field ('name:Thiago');
228
+ - You can pass the starting row and the number of rows per page,
229
+ which is usefull for pagination
230
+ <b>NEW</b>:: Included a method to rebuild the index files
231
+
232
+ <b>SCHEMA.XML</b>
233
+ <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.
data/README.markdown ADDED
@@ -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).
data/README.rdoc ADDED
@@ -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.