solr config changes
[wolnelektury.git] / doc / architecture.rst
1 Architecture overview
2 =====================
3
4 Books
5 -----
6
7 Books are kept in the :py:class:`catalogue.models.Book` model.  Dublin Core
8 metadata, read by :py:mod:`librarian.dcparser.BookInfo`, are put in the
9 `extra_info` JSON field.
10
11 Authors, kinds, epochs, genres are kept in :py:class:`catalogue.models.Tag`
12 model with `category` field set to appriopriate value.
13
14 :py:class:`catalogue.models.Tag` also contains :ref:`user-shelves`
15 and :ref:`parent-relations`.
16
17
18 User shelves
19 ------------
20
21 User shelves (or tags on user's shelf) are just :py:class:`catalogue.models.Tag`
22 objects with ``category='set'`` and ``user`` set to the owner. Shelves' slugs
23 are generated automatically using :py:fun:`catalogue.utils.get_random_hash`.
24
25
26 Parent relations
27 ----------------
28
29 The source of parent relations is the
30 :py:class:`librarian.dcparser.BookInfo.parts` metadata.
31
32 Parent relations are kept primarily in the :py:attribute:`catalogue.models.Book.parent`
33 and :py:attribute:`catalogue.models.Book.parent_number` fields.
34
35 They're also cached as :py:class:`Tag <catalogue.models.Tag>` relations.
36 Each book has its tag (with :py:attribute:`slug <catalogue.models.Book.slug>`
37 starting with ``l-``).  All of book's descendants (NOT the book
38 itself) have its tag attached.
39
40 Arguably, this scheme has some potential for inconsistency.