Full-text search for Wagtail
- Python ...
- Django ...
- Wagtail ...
python -m pip install wagtailsearch
- ...
To make changes to this project, first clone this repository:
git clone https://github.com/wagtail/wagtailsearch.git
cd wagtailsearch
With your preferred virtualenv activated, install testing dependencies:
python -m pip install --upgrade pip>=21.3
python -m pip install -e '.[testing]' -U
python -m pip install flit
flit install
Note that this project uses pre-commit. It is included in the project testing requirements. To set up locally:
# go to the project directory
$ cd wagtailsearch
# initialize pre-commit
$ pre-commit install
# Optional, run all checks once for this, then the checks will run only on the changed files
$ git ls-files --others --cached --exclude-standard | xargs pre-commit run --files
A Vagrant provisioning script is provided to install the dependencies for various backends. To install:
vagrant up
vagrant ssh
To test under sqlite:
source ~/.virtualenvs/wagtailsearch/bin/activate
cd /vagrant/
python testmanage.py test
To test under PostgreSQL:
source ~/.virtualenvs/wagtailsearch/bin/activate
cd /vagrant/
DATABASE_URL="postgres:///wagtailsearch" python ./testmanage.py test
To test under MySQL:
source ~/.virtualenvs/wagtailsearch/bin/activate
cd /vagrant/
DATABASE_URL="mysql://vagrant:vagrant@localhost/wagtailsearch" python ./testmanage.py test
To test under Elasticsearch 7:
/home/vagrant/elasticsearch-7.17.29/bin/elasticsearch
# then in another shell session:
source ~/.virtualenvs/wagtailsearches7/bin/activate
# or to test against the pre-7.15 client library:
# source ~/.virtualenvs/wagtailsearches70/bin/activate
cd /vagrant/
ELASTICSEARCH_URL="http://wagtail:wagtail@localhost:9200" ELASTICSEARCH_VERSION=7 python testmanage.py test
To test under Elasticsearch 8:
/home/vagrant/elasticsearch-8.19.3/bin/elasticsearch
# then in another shell session:
source ~/.virtualenvs/wagtailsearches8/bin/activate
cd /vagrant/
ELASTICSEARCH_URL="https://wagtail:wagtail@localhost:9200" ELASTICSEARCH_VERSION=8 ELASTICSEARCH_CA_CERTS=~/elasticsearch-8.19.3/config/certs/http_ca.crt python testmanage.py test
To test under Opensearch 2:
/home/vagrant/opensearch-2.19.3/bin/opensearch
# then in another shell session:
source ~/.virtualenvs/wagtailsearchopensearch2/bin/activate
cd /vagrant/
OPENSEARCH_URL="http://localhost:9200" OPENSEARCH_VERSION=2 python testmanage.py test
To test under Opensearch 3:
/home/vagrant/opensearch-3.2.0/bin/opensearch
# then in another shell session:
source ~/.virtualenvs/wagtailsearchopensearch3/bin/activate
cd /vagrant/
OPENSEARCH_URL="http://localhost:9200" OPENSEARCH_VERSION=3 python testmanage.py test
To test under all environments and produce a coverage report:
cd /vagrant/
make coverage