File: architecture_overview.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 (66 lines) | stat: -rw-r--r-- 1,704 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.. _ref-architecture-overview:

=====================
Architecture Overview
=====================

``SearchQuerySet``
------------------

One main implementation.

* Standard API that loosely follows ``QuerySet``
* Handles most queries
* Allows for custom "parsing"/building through API
* Dispatches to ``SearchQuery`` for actual query
* Handles automatically creating a query
* Allows for raw queries to be passed straight to backend.


``SearchQuery``
---------------

Implemented per-backend.

* Method for building the query out of the structured data.
* Method for cleaning a string of reserved characters used by the backend.

Main class provides:

* Methods to add filters/models/order-by/boost/limits to the search.
* Method to perform a raw search.
* Method to get the number of hits.
* Method to return the results provided by the backend (likely not a full list).


``SearchBackend``
-----------------

Implemented per-backend.

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


``SearchSite``
--------------

One main implementation.

* Standard API that loosely follows ``django.contrib.admin.sites.AdminSite``
* Handles registering/unregistering models to search on a per-site basis.
* Provides a means of adding custom indexes to a model, like ``ModelAdmins``.


``SearchIndex``
---------------

Implemented per-model you wish to index.

* Handles generating the document to be indexed.
* Populates additional fields to accompany the document.
* Provides a way to limit what types of objects get indexed.
* Provides a way to index the document(s).
* Provides a way to remove the document(s).