Django integration with Meilisearch
Project description
Django-Meili
A package to integrate Meilisearch with Django in a seamless way.
Usage
Set the following variables in settings.py
.
MEILI_HOST=localhost # This is the host for meilisearch
MEILI_PORT=7700 # The port to listen on
MEILI_HTTPS=False # Is the meilisearch running on http or https
MEILI_MASTER_KEY="..." # Meilisearch's master key
Register the app in INSTALLED_APPS
INSTALLED_APPS = [
...,
"django_meili",
...,
]
Just subclass django_meili.models.IndexMixin
from django_meili.models import IndexMixin
class Post(IndexMixin, models.Model):
id = models.UUIDField()
title = models.CharField(max_length=255)
body = models.TextField()
# Attributes to handle in Meilisearch
displayed_fields = ("title", "body")
searchable_fields = ("title", "body")
API
django_meili.models.IndexMixin
Subclass Parameters:
Name | Type | Description |
---|---|---|
index_name | Optional[str] |
The name of the index to generate. Defaults to __name__ attribute. |
primary_key | Optional[str] |
The primary key of the index. Defaults to pk . |
Attributes:
Name | Type | Description |
---|---|---|
displayed_fields | tuple[str] |
The fields to display. By default uses all. |
searchable_fields | tuple[str] |
The fields to search. By default uses all. |
filterable_fields | tuple[str] |
The fields to filter. By default uses none. |
Copyright 2023 Ian Kollipara <ian.kollipara@cune.edu>
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
django-meili-0.0.1.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for django_meili-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfe6bbf73d0defdc2f0ea2352a8615b304af7e8189b0d4ce5b1ee3e3c08163f6 |
|
MD5 | 247cfd2c31f94b9b8b1b3dbad691acae |
|
BLAKE2b-256 | a118b54f3dcbf6b1174800c2f52cab9f45eec659028bad543c82ba8ce900f275 |