== CHANGE_LOG === Development NEW:: Return an empty SearchResult, rather than nil, when the query returns nothing. NEW:: Better error message for parse errors. NEW:: Using ENV['RAILS_ENV'] instead of RAILS_ENV, so multiple test environments are supported. FIX:: Fixed load path collisions NEW:: Gemified acts_as_solr NEW:: A unit test suite based on Shoulda, not requiring a running Solr or a Rails environment. (Mathias Meyer) NEW:: Added the :offline option to the acts_as_solr method. (Mathias Meyer) NEW:: Added :lazy flag to find_by_solr, and with that support to load records lazily. (Mathias Meyer) FIX:: Added test: to solr.yml so you don't need to do this by hand. (Ken Harris) FIX:: Updated bundled Solr to 1.3. (Mathias Meyer) FIX:: Updated bundled solr-ruby to 0.0.6 which comes bundled with Solr 1.3. (Mathias Meyer) FIX:: Improved logging of the reindex rake task. (David Stevenson) FIX:: Added requirement for libxml-ruby > 0.7, if libxml-ruby is installed. (David Stevenson) FIX:: Ruby 1.9 compatibility fixes. (David Palm) FIX:: Fixed compatibility with Desert by renaming environment.rb to solr_environment.rb. (David Stevenson) FIX:: Moved the require of solr_environment only into tasks that need it. (David Stevenson) NEW:: Added support to alias fields and includes using the option :as for acts_as_solr. See the RDoc for details. (Nick Hengeveld) NEW:: Added support to attach the score to multi search results. (Mathias Meyer) NEW:: Added support for facets on date fields. (Curtis Hatter) === 06-18-2007: Version 0.9 NEW:: 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 books = Book.find_by_solr 'ruby OR splinter', :scores => true books.records.first.solr_score => 1.21321397 books.records.last.solr_score => 0.12321548 NEW:: Major change on the way the results returned are accessed. books = Book.find_by_solr 'ruby' # the above will return a SearchResults class with 4 methods: # docs|results|records: will return an array of records found # # books.records.is_a?(Array) # => true # # total|num_found|total_hits: will return the total number of records found # # books.total # => 2 # # facets: will return the facets when doing a faceted search # # max_score|highest_score: returns the highest score found # # books.max_score # => 1.3213213 NEW:: Integrating acts_as_solr to use solr-ruby as the 'backend'. Integration based on the patch submitted by Erik Hatcher NEW:: 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.) NEW:: Adding the option to specify the port Solr should start when using rake solr:start rake solr:start RAILS_ENV=your_env PORT=XX NEW:: Adding deprecation warning for the :background configuration option. It will no longer be updated. NEW:: Adding support for models that use a primary key other than integer class Posting < ActiveRecord::Base set_primary_key 'guid' #string #make sure you set the :primary_key_field => 'pk_s' if you wish to use a string field as the primary key acts_as_solr({},{:primary_key_field => 'pk_s'}) end FIX:: 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.) FIX:: Re-factoring code submitted by Daniel E. NEW:: Adding an :auto_commit option that will only send the commit command to Solr if it is set to true class Author < ActiveRecord::Base acts_as_solr :auto_commit => false end FIX:: Fixing bug on rake's test task FIX:: Making acts_as_solr's Post class compatible with Solr 1.2 (thanks Si) NEW:: Adding Solr 1.2 FIX:: Removing Solr 1.1 NEW:: Adding a conditional :if option to the acts_as_solr call. It behaves the same way ActiveRecord's :if argument option does. class Electronic < ActiveRecord::Base acts_as_solr :if => proc{|record| record.is_active?} end NEW:: Adding fixtures to Solr index when using rake db:fixtures:load FIX:: Fixing boost warning messages FIX:: Fixing bug when adding a facet to a field that contains boost NEW:: Deprecating find_with_facet and combining functionality with find_by_solr NEW:: Adding the option to :exclude_fields when indexing a model class User < ActiveRecord::Base acts_as_solr :exclude_fields => [:password, :login, :credit_card_number] end FIX:: Fixing branch bug on older ruby version NEW:: Adding boost support for fields and documents being indexed: class Electronic < ActiveRecord::Base # You can add boosting on a per-field basis or on the entire document acts_as_solr :fields => [{:price => {:boost => 5.0}}], :boost => 5.0 end FIX:: Fixed the acts_as_solr limitation to only accept test|development|production environments. === 05-16-2007: Version 0.8.5 FIX:: 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. FIX:: Better handling of nil values from indexed fields. Solr complained when indexing fields with field type and the field values being passed as nils. NEW:: Adding Solr sort (order by) option to the search query (thanks Kevin Hunt) FIX:: Applying patch suggested for increasing the Solr commit speed (thanks Mourad Hammiche) FIX:: Updated documentation === 05-10-2007: Version 0.8 NEW: New video tutorial NEW: Faceted search has been implemented and its possible to 'drill-down' on the facets NEW: New rake tasks you can use to start/stop the solr server in test, development and production environments: (thanks Matt Clark) rake solr:start|stop RAILS_ENV=test|development|production (defaults to development if none given) NEW: Changes to the plugin's test framework and it now supports Sqlite as well (thanks Matt Clark) FIX: Patch applied (thanks Micah) that allows one to have multiple solr instances in the same servlet FIX: Patch applied (thanks Micah) that allows indexing of STIs FIX: Patch applied (thanks Gordon) that allows the plugin to use a table's primary key different than 'id' FIX: Returning empty array instead of empty strings when no records are found FIX: Problem with unit tests failing due to order of the tests and speed of the commits === 02-16-2007: Version 0.7 NEW: You can now specify the field types when indexing and searching if you'd like to preserve its original type: Indexing Each field passed can also be a hash with the value being a field type class Electronic < ActiveRecord::Base acts_as_solr :fields => [{:price => :range_float}, {:current_time => :date}] def current_time Time.now end end Searching Electronic.find_by_solr "ipod AND price:[* TO 59.99]", :field_types => [{:price => :range_float}] The field types accepted are: :float:: Index the field value as a float (ie.: 12.87) :integer:: Index the field value as an integer (ie.: 31) :boolean:: Index the field value as a boolean (ie.: true/false) :date:: Index the field value as a date (ie.: Wed Nov 15 23:13:03 PST 2006) :string:: Index the field value as a text string, not applying the same indexing filters as a regular text field :range_integer:: Index the field value for integer range queries (ie.:[5 TO 20]) :range_float:: Index the field value for float range queries (ie.:[14.56 TO 19.99]) Setting the field type preserves its original type when indexed FIX: Fixing sorting bug. Thanks for the catch Laurel FIX: Fixing small bug when installing the plugin NEW: Adding the :additional_fields option to the acts_as_solr method === 02-05-2007: Version 0.6.5 NEW:: Added multi-model search, which can be used to execute a search across multiple models: Book.multi_solr_search "Napoleon OR Tom", :models => [Movie] ====options: Accepts the same options as find_by_solr plus: models:: The additional models you'd like to include in the search results_format:: Specify the format of the results found :objects :: Will return an array with the results being objects (default). Example: Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :objects :ids :: Will return an array with the ids of each entry found. Example: Book.multi_solr_search "Napoleon OR Tom", :models => [Movie], :results_format => :ids => [{"id" => "Movie:1"},{"id" => Book:1}] Where the value of each array is as Model:instance_id === 02-03-2007: Version 0.6 NEW:: Added basic faceted search functionality for indexing and searching: ==== Indexing: class Electronic < ActiveRecord::Base acts_as_solr :facets => [:category, :manufacturer] end ==== Searching: Electronic.find_with_facet "memory", :facets => {:fields =>[:category]} === 01-15-2007: Version 0.5 NEW:: Added model association indexing, which means you can include any :has_one, :has_many, :belongs_to and :has_and_belongs_to_many association to be indexed: class Category < ActiveRecord::Base has_many :books acts_as_solr :include => [:books] end class Book < ActiveRecord::Base belongs_to :category acts_as_solr :include => [:category] end === 01-11-2007: NEW:: Added the acts_as_solr's plugin tests === 11-07-2006: Version 0.4 NEW:: 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) === 11-02-2006: Version 0.3 NEW:: Added a method (Model.count_by_solr) that returns the total number of documents found based on query passed NEW:: Added configuration for production and development environments === 10-21-2006: Version 0.2 PLUGIN FIX:: Fixed bug when mixing search-by-field and 'free' search: Model.find_by_solr 'solr AND name:Thiago' FIX:: Fixed bug with multi-terms search: Book.find_by_solr 'anteater john' FIX:: Fixed bug when including more than one search field: Model.find_by_solr 'name:Thiago AND engine:Solr' FIX:: Fixed bug when rebuilding the index, it wasn't saving the data NEW:: Added the ability to index custom methods from a model as search fields NEW:: Added a search method (Model.find_id_by_solr) that will return only the id of the results SCHEMA.XML NEW:: Added a new field: NEW:: Added a default search field: default FIX:: Changed the defaultOperator to AND instead of OR === 09-29-2006: Version 0.1 PLUGIN NEW:: Included the option of having a Solr config file inside the rails env. NEW:: Added the ability of indexing only certain fields, if you chose to. NEW:: Added configuration options NEW:: Changed the way the search was done: Old: You were forced the specify the field you wanted to look for ('field:value') and you had to specify a default search field as well, for when you didn't include the 'field' in the search term New: The new search features include: - You don't have to specify a default search field; - You are not forced to include the field name in the search term, unless you choose to search for a specific field ('name:Thiago'); - You can pass the starting row and the number of rows per page, which is usefull for pagination NEW:: Included a method to rebuild the index files SCHEMA.XML NEW:: Created an optimized version of the config file to better work with this plugin