Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 67 lines (44 sloc) 2.224 kb
a038098d »
2012-05-14 Not really needed
1 # Search plugin for [Refinery CMS](http://www.refinerycms.com)
45ec12ca »
2010-04-01 Added Readme
2
a038098d »
2012-05-14 Not really needed
3 Powered by: [acts_as_indexed](http://github.com/dougal/acts_as_indexed) -
4 Check his readme and documentation for more info on how it works.
86e8f9f0 »
2010-10-12 Give credit to the gem and point people there for more info & help on…
5
a8e679d9 »
2010-10-01 Converted to a Rails3/Refinery CMS engine.
6 ## Installation
45ec12ca »
2010-04-01 Added Readme
7
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
8 Simply use this by adding the following to your `Gemfile`:
45ec12ca »
2010-04-01 Added Readme
9
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
10 ```ruby
48ec08d4 »
2012-09-04 Updating Git Location
11 gem 'refinerycms-search', '~> 2.0.0', :git => 'git://github.com/refinery/refinerycms-search.git', :branch => '2-0-stable'
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
12 ```
45ec12ca »
2010-04-01 Added Readme
13
aa535afa »
2012-03-12 Update readme.
14 ## RE-SAVE all records that have not been indexed before.
45ec12ca »
2010-04-01 Added Readme
15
bafe958d »
2012-03-12 Fix typo in readme.
16 A sample search form can be found in [views/refinery/shared/_search.html.erb](http://github.com/resolve/refinerycms-search/blob/master/app/views/refinery/shared/_search.html.erb).
a8e679d9 »
2010-10-01 Converted to a Rails3/Refinery CMS engine.
17 You can either use this partial directly, or copy the appropriate parts.
45ec12ca »
2010-04-01 Added Readme
18
a8e679d9 »
2010-10-01 Converted to a Rails3/Refinery CMS engine.
19 ## Searching
45ec12ca »
2010-04-01 Added Readme
20
25a50249 »
2010-11-12 Let's try a different approach which is far more likely to work :-)
21 The default installation will search in Pages.
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
22 If you wish to find results in other plugins you have created or installed, you can specify these in `config/application.rb` like so:
45ec12ca »
2010-04-01 Added Readme
23
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
24 ```ruby
25 config.to_prepare do
26 Refinery.searchable_models = [Refinery::Page]
27 end
28 ```
45ec12ca »
2010-04-01 Added Readme
29
30 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:
31
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
32 ```ruby
33 config.to_prepare do
34 Refinery.searchable_models = [Refinery::Page, Refinery::PortfolioEntry]
35 end
36 ```
eed054bd »
2010-09-30 These changes help it work in Rails3 RefineryCMS acceptably.
37
14c27f36 »
2010-10-12 Helpful tips in the README
38 The above line will add indexing to PortfolioEntry in the portfolio plugin, which does not come indexed.
39
a8e679d9 »
2010-10-01 Converted to a Rails3/Refinery CMS engine.
40 Any model you wish to search will need to be indexed using acts as indexed. To add indexing, simple add:
45ec12ca »
2010-04-01 Added Readme
41
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
42 ```ruby
43 acts_as_indexed :fields => [:title, :body]
44 ```
45ec12ca »
2010-04-01 Added Readme
45
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
46 If your model doesn't use a `:title` attribute, remember to add an `alias_attribute`:
284cb307 »
2010-07-22 README updated with a couple of friendly reminders
47
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
48 ```ruby
49 alias_attribute :title, :name #for example
50 ```
284cb307 »
2010-07-22 README updated with a couple of friendly reminders
51
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
52 You can use any public method, as well. So if you have `:first_name` and `:last_name` but a method like `name` to join them, it can be indexed.
25a50249 »
2010-11-12 Let's try a different approach which is far more likely to work :-)
53
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
54 ```ruby
55 acts_as_indexed :fields => [:name, :biography]
25a50249 »
2010-11-12 Let's try a different approach which is far more likely to work :-)
56
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
57 #...
25a50249 »
2010-11-12 Let's try a different approach which is far more likely to work :-)
58
5aef6f9c »
2012-04-17 Updated readme to have syntax highlighting and to recommend installin…
59 def name
60 [first_name, last_name].reject(&:blank?).join(' ')
61 end
62 ```
14c27f36 »
2010-10-12 Helpful tips in the README
63
a8e679d9 »
2010-10-01 Converted to a Rails3/Refinery CMS engine.
64 You will need to replace the indexed fields with those appropriate for your model.
14c27f36 »
2010-10-12 Helpful tips in the README
65
2e2e2cf4 »
2012-04-17 Merge branch '2-0-stable'
66 If you wish to override the url used in the search results just add a `url` method to your model and the result of this method will be used instead.
Something went wrong with that request. Please try again.