Skip to content

Commit

Permalink
These changes help it work in Rails3 RefineryCMS acceptably.
Browse files Browse the repository at this point in the history
  • Loading branch information
joemsak committed Sep 30, 2010
1 parent e2cae61 commit eed054b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/models/search_engine.rb
Expand Up @@ -8,7 +8,7 @@ def self.search(query, page = 1)
if query.present?
results = []

Refinery.searchable_models.each do |model|
[Page].each do |model|
results << model.with_query(query).find(:all, :limit => RESULTS_LIMIT)
end

Expand Down
15 changes: 0 additions & 15 deletions rails/init.rb

This file was deleted.

16 changes: 15 additions & 1 deletion readme.md
Expand Up @@ -8,6 +8,10 @@ By: [Resolve Digital](http://www.resolvedigital.com)
Just 'git clone' Refinery, install this as a plugin using:

script/plugin install git://github.com/resolve/refinerycms-search.git

*Rails 3*

rails plugin install git://github.com/resolve/refinerycms-search.git

You'll also need to create a page (from the 'Pages' tab) with a custom URL of '/search'. You can set a custom URL for a page in the Advanced Options. It's probably also a good idea to uncheck the 'show in menu' option for this page.

Expand All @@ -24,6 +28,12 @@ The default installation will search in Pages. If you wish to find results in o
Simply add any additional models you wish to search to this array. For example, if you have the [portfolio plugin](http://github.com/resolve/refinerycms-portfolio) installed:

Refinery.searchable_models = [Page, PortfolioEntry]

*Rails 3*

Update ln 11 in search_engine.rb

[Page, PortfolioEntry].each do |model|

Any model you wish to search will need to be indexed using acts as indexed. To add indexing, simple add

Expand All @@ -35,4 +45,8 @@ If your model doesn't use a :title attribute, remember to use an alias_attribute

to the model. Obviously, replaced the indexed fields with those appropriate for your model. The above line will add indexing to PortfolioEntry in the portfolio plugin, which does not come indexed.

If you wish to override the url used in the search results, add a 'url' method to your model, and the result of this method will be used instead.
If you wish to override the url used in the search results, add a 'url' method to your model, and the result of this method will be used instead.

*Rails 3 Notes*

This was a quick patch to make this plugin work acceptably for RefineryCMS in rails3. Conversion to an engine would be preferable.

0 comments on commit eed054b

Please sign in to comment.