wvanbergen/scoped_search — pull request #24 by brocktimus (2012-08-07 09:16:12+00:00)
Title: PostgreSQL Full Text Search

The included changes implement full text searching on postgresql. This allows for indexes to be used during searching which can increase query speed to near sphinx / lucene levels.

An updated definition using this would be the following (where english is the locale).

scoped_search on: :name, full_text_search: :english

To gain the speed benefit an index must be manually created:

CREATE INDEX widgets_name_full_text_search ON widgets USING gin(to_tsvector('english', name));

This replaces ILIKE as the query used, however, it is not a drop in replacement for ILIKE in functionality. This performs more complex matching but at the same time doesn't do things like matching substrings.