All Projects → wagtail → wagtail-pg-search-backend

wagtail / wagtail-pg-search-backend

Licence: MIT license
PostgreSQL full text search backend for Wagtail CMS

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to wagtail-pg-search-backend

wagtaildraftail
🐦📝🍸 Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter
Stars: ✭ 23 (+4.55%)
Mutual labels:  wagtail
wagtail-simple-gallery
A simple gallery app for Wagtail. https://pypi.org/project/wagtail-simple-gallery/
Stars: ✭ 41 (+86.36%)
Mutual labels:  wagtail
wagtailmath
Beautiful equations in your StreamField content
Stars: ✭ 27 (+22.73%)
Mutual labels:  wagtail
wagtail-sharing
Easier sharing of Wagtail drafts
Stars: ✭ 46 (+109.09%)
Mutual labels:  wagtail
wagtail-react-project
Wagtail template with a React/Redux frontend.
Stars: ✭ 25 (+13.64%)
Mutual labels:  wagtail
localore
Wagtail-based CMS and Ansible playbooks for Localore: Finding America
Stars: ✭ 16 (-27.27%)
Mutual labels:  wagtail
vagrant-wagtail-develop
A script to painlessly set up a Vagrant environment for development of Wagtail
Stars: ✭ 36 (+63.64%)
Mutual labels:  wagtail
Django-wagtailmedium
A Medium Editor integration for the Wagtail CMS.
Stars: ✭ 17 (-22.73%)
Mutual labels:  wagtail
gatsby-source-wagtail
Plugin for sourcing Gatsby data from Wagtail CMS
Stars: ✭ 16 (-27.27%)
Mutual labels:  wagtail
wagtailgridder
Wagtail Gridder is a Bootstrap 4 enabled layout for the Wagtail CMS. Grid Items are created within categories, and displayed on a Grid Index Page. The JavaScript libraries Gridder and MixItUp are included.
Stars: ✭ 59 (+168.18%)
Mutual labels:  wagtail
wagtail-filepreviews
Extend Wagtail's Documents with image previews and metadata from FilePreviews
Stars: ✭ 21 (-4.55%)
Mutual labels:  wagtail
wagtail-import-export
UNMAINTAINED. Try wagtail-transfer, the evolution of this package: https://github.com/wagtail/wagtail-transfer/
Stars: ✭ 31 (+40.91%)
Mutual labels:  wagtail
wagtail-cache
A simple page cache for Wagtail based on the Django cache middleware.
Stars: ✭ 63 (+186.36%)
Mutual labels:  wagtail
WF-website
Website for Western Friend, part of the Religious Society of Friends
Stars: ✭ 34 (+54.55%)
Mutual labels:  wagtail
draftjs-filters
Filter Draft.js content to preserve only the formatting you allow
Stars: ✭ 53 (+140.91%)
Mutual labels:  wagtail
wagtail-redirect-importer
Note: This library is now included in Wagtail 2.10, use the builtin version instead of this.
Stars: ✭ 15 (-31.82%)
Mutual labels:  wagtail
wagtail-graphql
App to automatically add GraphQL support to a Wagtail website
Stars: ✭ 37 (+68.18%)
Mutual labels:  wagtail
pari
Django/Wagtail based PARI webapp
Stars: ✭ 32 (+45.45%)
Mutual labels:  wagtail
wagtailcolumnblocks
Streamfield columns for Wagtail
Stars: ✭ 38 (+72.73%)
Mutual labels:  wagtail
react-streamfield
Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)
Stars: ✭ 34 (+54.55%)
Mutual labels:  wagtail

Archived - This search backend is now included in Wagtail.

Wagtail PostgreSQL full text search backend

A PostgreSQL full text search backend for Wagtail CMS.

Installation

PostgreSQL full text search in Wagtail requires PostgreSQL >= 9.2 (noticable speed improvements are in place for PostgreSQL >= 9.5), Django >= 1.10 and Wagtail >= 1.8.

First, install the module using:

pip install wagtail-pg-search-backend

Then you'll need to do a little bit of configuration.

Add the following to the project settings:

INSTALLED_APPS = [
    ...
    'wagtail_pgsearchbackend'
    ...
]

WAGTAILSEARCH_BACKENDS = {
    'default': {
        'BACKEND': 'wagtail_pgsearchbackend.backend',
        'SEARCH_CONFIG': 'english'
    }
}

Then run migrations to add the required database table:

./manage.py migrate wagtail_pgsearchbackend

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

Usage

This backend implements the required methods to be compatible with most features mentioned in the the Wagtail search docs.

Known limitations

  • SearchField.partial_match behaviour is not implemented.
  • Due to a PostgreSQL limitation, SearchField.boost is only partially respected. It is changed so that there can only be 4 different boosts. If you define 4 or less different boosts, everything will be perfectly accurate. However, your search will be a little less accurate if you define more than 4 different boosts. That being said, it will work and be roughly the same.
  • SearchField.es_extra is not handled because it is specific to ElasticSearch.
  • Using SearchQuerySet.search while limiting to specific field(s) is only supported for database fields, not methods.

Performance

The PostgreSQL search backend has been tried and tested on a few small to medium sized website and its performance compares favorably to that of ElasticSearch.

Some noticeable speed improvements are in place when using PostgreSQL >= 9.5.

Features to add

These features would awesome to have once this project is merged with Wagtail:

  • Per-object boosting
  • Faceting
  • Autocomplete (maybe it should replace partial search?)
  • Spelling suggestions

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].