Metadata-Version: 2.4
Name: drf-haystack
Version: 1.9.3
Summary: Makes Haystack play nice with Django REST Framework
Author: Dhaval Gojiya, Rolf Håvard Blindheim, Ülgen Sarıkavak
Author-email: Dhaval Gojiya <dhavalgojiya10@gmail.com>, Rolf Håvard Blindheim <rhblind@gmail.com>, Ülgen Sarıkavak <foss@ulgenwanders.net>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: django>=5.2,<6.2
Requires-Dist: django-haystack>=3.3.0,<4
Requires-Dist: djangorestframework>=3.16
Requires-Dist: python-dateutil
Requires-Python: >=3.11, <3.15
Project-URL: Documentation, https://drf-haystack.readthedocs.io
Project-URL: Homepage, https://github.com/django-commons/drf-haystack
Project-URL: Issues, https://github.com/django-commons/drf-haystack/issues
Project-URL: Repository, https://github.com/django-commons/drf-haystack.git
Description-Content-Type: text/markdown

Haystack for Django REST Framework
==================================

Build status
------------

[![Coverage Status](https://coveralls.io/repos/github/django-commons/drf-haystack/badge.svg?branch=main)](https://coveralls.io/github/django-commons/drf-haystack?branch=main)
[![PyPI version](https://badge.fury.io/py/drf-haystack.svg)](https://badge.fury.io/py/drf-haystack)
[![Documentation Status](https://readthedocs.org/projects/drf-haystack/badge/?version=latest)](http://drf-haystack.readthedocs.io/en/latest/?badge=latest)


About
-----

Small library which tries to simplify integration of Haystack with Django REST Framework.
Fresh [documentation available](https://drf-haystack.readthedocs.io/en/latest/) on Read the docs!

Supported versions
------------------

- Python >=3.11, <3.15
- Django >=5.2, <6.2
- Haystack >=3.3.0, <4
- Django REST Framework >=3.16
- Elasticsearch >=7.0.0, <8


Installation
------------

    $ pip install drf-haystack

Supported features
------------------
We aim to support most features Haystack does (or at least those which can be used in a REST API).
Currently, we support:

- Autocomplete
- Boost (Experimental)
- Faceting
- Geo Spatial Search
- Highlighting
- More Like This

Show me more!
-------------

```python
from drf_haystack.serializers import HaystackSerializer
from drf_haystack.viewsets import HaystackViewSet

from myapp.search_indexes import PersonIndex  # You would define this Index normally as per Haystack's documentation


# Serializer
class PersonSearchSerializer(HaystackSerializer):
    class Meta:
        index_classes = [PersonIndex]
        fields = ["firstname", "lastname", "full_name"]


# ViewSet
class PersonSearchViewSet(HaystackViewSet):
    index_models = [Person]
    serializer_class = PersonSerializer
```

That's it, you're good to go. Hook it up to a DRF router and happy searching!
