Skip to content
Newer
Older
100644 36 lines (19 sloc) 1.76 KB
45ec12c Added Readme
Amanda Nicholas authored
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
11
12 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.
13
284cb30 @joemsak README updated with a couple of friendly reminders
joemsak authored
14 Remember to restart your server.
15
45ec12c Added Readme
Amanda Nicholas authored
16 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.
17
18 ## Searching in plugins
19
20 The default installation will search in Pages and NewsItems. If you wish to find results in other plugins you have created or installed, you'll need to modify the SearchEngine model. On line 14, you'll find an array of models to search:
21
22 [Page, NewsItem].each do |model|
23
24 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:
25
26 [Page, NewsItem, PortfolioEntry].each do |model|
27
28 Any model you wish to search will need to be indexed using acts as indexed. To add indexing, simple add
29
30 acts_as_indexed :fields => [:title, :body], :index_file => [Rails.root.to_s, "tmp", "index"]
31
284cb30 @joemsak README updated with a couple of friendly reminders
joemsak authored
32 If your model doesn't use a :title attribute, remember to use an alias_attribute:
33
34 alias_attribute :title, :name #for example
35
45ec12c Added Readme
Amanda Nicholas authored
36 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.
Something went wrong with that request. Please try again.