-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
31 lines (17 loc) · 1.19 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Thinking Sphinx Excerpt Highlighting
=================================
This plugin extends Thinking Sphinx to do excerpt highlighting. That means you can present search results and have the words around the search terms excerpted with the search term highlighted.
To install:
script/plugin install [email protected]:dfurber/thinking_sphinx_excerpts.git
Example
=======
Post.search "garden", :excerpts => true
By default the search terms are highlighted with <strong> tags. If you want a different tag, specify it as follows in a config/initializer:
ThinkingSphinx.configure_excerpts :wraptag => "em"
Pagination
==========
Thinking Sphinx has gone more aggressively in the direction of forcing you to use Will Paginate. However, if you have paginating_find available, then this plugin will transform the results into a PagingEnumerator regardless of whether you perform excerpting. If you have paginating_find but for some reason would rather use will_paginate:
ThinkingSphinx:.configure_excerpts :paginating_find => false
In either scenario, the following would yield the second page of Davids:
User.search "David", :excerpts => true, :page => 2
Copyright (c) 2010 David Furber, released under the MIT license