Pure Postgresql search backend for Django Oscar
Project description
Postgresql search handler for Django-Oscar
This creates a search handler without the need of any search backend. It is designed for the e-commerce framework Oscar.
It is implemented a little bit expensive but uses 4 annotated search vectors: * upc * title * meta_description * meta_title
This way the search can be manipulated through the meta fields. It is running productive in a heavily customized env for many months now. I think it should scale up to 5000 Products with 10 Attributes depending on how the products are loaded. We use it fully lazy with endless scrolling.
To-Do
- Provide a generic way to use filter forms
- Writing Tests
Features
- Don't need to use some additional search backend like elastic
- Creates filters (facets) for:
- Data that is directly attached to the Product model
- including foreign key choices
- AttributeValues of the products
- StockRecord entries
Installation
Install using pip:
pip install django-oscar-pg-search
# settings.py
# replace 'oscar.apps.search.apps.SearchConfig' by 'oscar_pg_search.apps.PgSearchConfig'
INSTALLED_APPS = [
# 'oscar.apps.search.apps.SearchConfig',
'oscar_pg_search.apps.PgSearchConfig',
]
OSCAR_PRODUCT_SEARCH_HANDLER = 'oscar_pg_search.postgres_search_handler.PostgresSearchHandler'
# To avoid exception, haystack is not used:
HAYSTACK_CONNECTIONS = {"default": {}}
Trigram search is our search algorithm. Enable it at your database by executing the following sql:
CREATE EXTENSION pg_trgm;
Settings
If you want to add some fields that are directly attached to the Product model:
# settings.py
OSCAR_ATTACHED_PRODUCT_FIELDS = ['is_public', 'deposit', 'volume', 'weight',]
Project details
Release history Release notifications | RSS feed
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 django-oscar-pg-search-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5298d89ad96a7e951a4cc80a388181ae1467e2c2264c96dba186463e8ed72454 |
|
MD5 | c4ce708b9899090a7da707bc37d97152 |
|
BLAKE2b-256 | 5c667d1e2d1dfbb1cf8880edb5e0c3ec61b0f53aa2924ae2aae8cc7be8889705 |
Hashes for django_oscar_pg_search-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e90b7ae846e1106c9d688d70508fce6833f24512a68b3519eec51f6887055e3d |
|
MD5 | 395cf84303c0546cd721c396773db2f9 |
|
BLAKE2b-256 | 6a9c9becc50f78e72110ae277370b0cff94cd43b4f7fc1f62ef901978e8f0896 |