Skip to content

dfurber/thinking_sphinx_excerpts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 [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

About

A plugin for excerpt highlighting with Thinking Sphinx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages