PostgreSQL full text search backend for Wagtail CMS
Project description
A PostgreSQL full text search backend for Wagtail CMS.
Installation
PostgreSQL fulll text search requires PostgreSQL >= 9.2, Django >= 1.10 and Wagtail >= 1.8.
To start using PostgreSQL full text search you’ll need to do a little bit of configuration.
Add the following to the project’s settings:
INSTALLED_APPS = [ ... 'wagtail_pgsearchbackend' ... ] WAGTAILSEARCH_BACKENDS = { 'default': { 'BACKEND': 'wagtail_pgsearchbackend.backend', 'SEARCH_CONFIG': 'english' } }
Then run migrations to add the required database tables, e.g.:
./manage.py migrate
Configuration
The SEARCH_CONFIG key takes a text search configuration name. This controls the stemming, stopwords etc. used when searching and indexing the database. To get a list of the available config names use this query:
SELECT cfgname FROM pg_catalog.pg_ts_config
Development
Install the package and dev requirements:
pip install -e . -r requirements-dev.txt
Creating migrations
First create a database:
createdb -Upostgres wagtail_pgsearchbackend
Then call makemigrations using the test settings:
django-admin makemigrations --settings=tests.settings
Testing
To run the unittests for the current environment’s Python version and Wagtail run:
make unittests
To check the code for style errors run:
make flaketest
To combine these tasks run:
make
To run the unittest against all supported versions of Python and Wagtail run:
tox
The tox run will also create a coverage report combining the results of all runs. This report is located in htmlcov/index.html.
To run individual tests by name use the runtests.py script and give the dotted path the the test module(s), class(es) or method(s) that you want to test e.g.:
./runtests.py tests.test_module.TestClass.test_method
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wagtail-pg-search-backend-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a3ce915cb0578ad6bd8749856df5430b37e5603d445e74ee80c4b24d85afca |
|
MD5 | 52d79d824513294180884bb0f35cf51c |
|
BLAKE2b-256 | e071a5a5e46e6a97e6e2cb364c82abc6852217d3f57661de78c23841bd8d13df |
Hashes for wagtail_pg_search_backend-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c51b619c0b208e32a9b924596547a999347cd39b2f72cc846a2467906d7b392e |
|
MD5 | 134e707ddba38f622fcd877952bfc1e3 |
|
BLAKE2b-256 | 80fbc6e9ec418fb5b84e220fd5140e2029033a04e7a4eb778ea825e465e99ee6 |