etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

settings. SEARCH_CONFIG #180

Closed robslotboom closed 7 years ago

robslotboom commented 7 years ago

Hi folks,

Why not introduce SEARCH_CONFIG ="pg_catalog.english" in settings. It then can be refered to in Watson...

Cheers

Robert

robslotboom commented 7 years ago

I just added and changed a few lines of code and ran migrate watson without any problems.

settings.py

# Watson settings
if LANGUAGE_CODE == 'nl':
    SEARCH_CONFIG = "pg_catalog.dutch"
else:
    SEARCH_CONFIG = "pg_catalog.english"

watson/backends.py

from django.conf import settings

class PostgresSearchBackend(SearchBackend):
    search_config = getattr(settings, 'SEARCH_CONFIG', 'pg_catalog.english')

I’ll now register some models and do some tests.

To be continued...

etianen commented 7 years ago

Looks great!

Call it WATSON_POSTGRES_SEARCH_CONFIG, and hit me with a pull request!