Skip to content
master
Switch branches/tags
Code

Latest commit

According to v1.8.6 and #139 fields should be changed from serializers.IntegerField()/CharField()... to SerializerMethodField(). Also in get__<...> functions should be added instance arg couse of the DRF documentation.

I just read documentation without looking at the Chanel log and maybe if hadn't looked at the Chanel log after I would spend much more time searching what's wrong.
Please merge this request to avoid similar situations in the future :)
a61aeb2

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Haystack for Django REST Framework

Build status

Build Status Coverage Status PyPI version Documentation Status

About

Small library which tries to simplify integration of Haystack with Django REST Framework. Fresh documentation available on Read the docs!

Supported versions

  • Python 3.6 and above
  • Django 2.2 and 3.0
  • Haystack 2.8 and above
  • Django REST Framework 3.7 and above

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!

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

from myapp.search_indexes import PersonIndex  # BYOI™ (Bring Your Own Index)

# 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!