Skip to content
Newer
Older
100644 52 lines (27 sloc) 2.13 KB
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
1 # Search plugin for [RefineryCMS](http://www.refinerycms.com)
2 [Github](http://github.com/resolve/refinerycms)
3
4 By: [Resolve Digital](http://www.resolvedigital.com)
5
6 ## Plugin Installation
7
8 Just 'git clone' Refinery, install this as a plugin using:
9
10 script/plugin install git://github.com/resolve/refinerycms-search.git
eed054b @joemsak These changes help it work in Rails3 RefineryCMS acceptably.
joemsak authored Sep 30, 2010
11
12 *Rails 3*
13
14 rails plugin install git://github.com/resolve/refinerycms-search.git
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
15
16 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.
17
284cb30 @joemsak README updated with a couple of friendly reminders
joemsak authored Jul 22, 2010
18 Remember to restart your server.
19
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
20 A sample search form can be found in views/shared/_search.html.erb . You can either use this partial directly, or copy the appropriate parts.
21
22 ## Searching in plugins
23
e2cae61 @awagener Update Readme
awagener authored Aug 10, 2010
24 The default installation will search in Pages. If you wish to find results in other plugins you have created or installed, you can specify these in 'config/settings.rb' like so:
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
25
e2cae61 @awagener Update Readme
awagener authored Aug 10, 2010
26 Refinery.searchable_models = [Page]
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
27
28 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:
29
e2cae61 @awagener Update Readme
awagener authored Aug 10, 2010
30 Refinery.searchable_models = [Page, PortfolioEntry]
eed054b @joemsak These changes help it work in Rails3 RefineryCMS acceptably.
joemsak authored Sep 30, 2010
31
32 *Rails 3*
33
34 Update ln 11 in search_engine.rb
35
36 [Page, PortfolioEntry].each do |model|
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
37
38 Any model you wish to search will need to be indexed using acts as indexed. To add indexing, simple add
39
0b7ded1 @awagener Corrected format of sample call to acts_as_indexed
awagener authored Apr 13, 2010
40 acts_as_indexed :fields => [:title, :body]
45ec12c Added Readme
Amanda Nicholas authored Apr 1, 2010
41
284cb30 @joemsak README updated with a couple of friendly reminders
joemsak authored Jul 22, 2010
42 If your model doesn't use a :title attribute, remember to use an alias_attribute:
43
44 alias_attribute :title, :name #for example
45
e2cae61 @awagener Update Readme
awagener authored Aug 10, 2010
46 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.
47
eed054b @joemsak These changes help it work in Rails3 RefineryCMS acceptably.
joemsak authored Sep 30, 2010
48 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.
49
50 *Rails 3 Notes*
51
52 This was a quick patch to make this plugin work acceptably for RefineryCMS in rails3. Conversion to an engine would be preferable.
Something went wrong with that request. Please try again.