dfurber/thinking_sphinx_excerpts
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
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 git@github.com: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