etianen/django-watson — pull request #6 by nigma (2012-04-20 00:20:41+00:00)
Title: Specify text search configuration for PostgreSQL backend

The text search configuration attribute that can be overridden in a subclass allows for more flexible and natural text indexing and querying using features like unaccent[1] extension/dictionary. For example:

```sql
-- Postgres 9.1
CREATE EXTENSION unaccent;
CREATE TEXT SEARCH CONFIGURATION french_unaccent ( COPY = pg_catalog.french );
ALTER TEXT SEARCH CONFIGURATION french_unaccent
ALTER MAPPING FOR hword, hword_part, word
WITH unaccent, french_stem;

SELECT to_tsvector('french_unaccent', 'Hôtels de la Mer');
SELECT to_tsquery('french_unaccent', 'Hôtel');
SELECT ts_headline('french_unaccent', 'Hôtel de la Mer', to_tsquery('french_unaccent', 'Hotels'));
```

And then of course:

```python
class PostgresUnaccentSearchBackend(watson.backends.PostgresSearchBackend):
config = 'french_unaccent'
```

[1] - http://www.postgresql.org/docs/9.1/static/unaccent.html