File: creating_new_backends.rst

package info (click to toggle)
django-haystack 3.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,504 kB
  • sloc: python: 23,475; xml: 1,708; sh: 74; makefile: 71
file content (34 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.. _ref-creating-new-backends:

=====================
Creating New Backends
=====================

The process should be fairly simple.

#. Create new backend file. Name is important.
#. Two classes inside.

   #. SearchBackend (inherit from haystack.backends.BaseSearchBackend)
   #. SearchQuery (inherit from haystack.backends.BaseSearchQuery)


SearchBackend
=============

Responsible for the actual connection and low-level details of interacting with
the backend.

* Connects to search engine
* Method for saving new docs to index
* Method for removing docs from index
* Method for performing the actual query


SearchQuery
===========

Responsible for taking structured data about the query and converting it into a
backend appropriate format.

* Method for creating the backend specific query - ``build_query``.