implement directory categories in CouchDB backend
[mygpo.git] / doc / couch / views.txt
blob895abc257267c2a3f9b613837c9b9aba79cb1cb9
3                          View Overview
4                          ~~~~~~~~~~~~~
7 This file describes the views that will be used in the CouchDB based backend of
8 the gpodder.net webservice.
10 For each view the use case in the application is given.
13 Podcasts by ID
14 ~~~~~~~~~~~~~~
15  * For a Podcast, emits its id and the podcast itself.
16  * For a PodcastGroup, emits the contained podcasts with their ids.
18 Used for accessing a Podcast by id, even after it has been added to a group
19 (instead of accessing it without a view, what would not be possible for a
20 Podcast within a group).
23 Podcasts by Old-Id
24 ~~~~~~~~~~~~~~~~~~
25  * For a Podcast, emits its old_id and the podcast itself.
26  * For a PodcastGroup, emits the old_id and the podcast for all contained
27    podcasts.
29 Used to access Podcasts by the Ids used in the RDBMS-based backend.
32 Podcasts by Number of Subscribers
33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34  * For each Podcast, emits the latest number of subscribers
35  * For each PodcastGroup, emits the accumulated number of its Podcasts
37 Represents the Podcast Toplist when accessed reverse.
40 Podcasts by Tag
41 ~~~~~~~~~~~~~~~
42  * For each Podcast, iterates over all tags and emits
43    [tag, weight, Podcast] and the Podcast
44  * For each PodcastGroup, aggregates tags of all contained podcasts,
45    iterates over them and emits [tag, weight, PodcastGroup] and
46    the PodcastGroup
48 Contains Podcast(Group)s per Tag ordered by Weight. Can be used to get the
49 podcasts of a category, ordered by their weight.
52 Categories by Weight (directory/categories)
53 ~~~~~~~~~~~~~~~~~~~~
54  * For each Category, emit its Weight and the Category itself
56 A list of Categories ordered by their weight; used to construct the navigation
57 of the Podcast Directory.
60 Categories by Tags (directory/categories_by_tags)
61 ~~~~~~~~~~~~~~~~~~
62  * For each Category, emit its label and all its spellings, with
63    the Category itself
65 Can be used to get the Category for a given Tag, or all assigned Tags.
68 Episodes by Podcast
69 ~~~~~~~~~~~~~~~~~~~
70  * For each Episode, emit [Podcast, Release-Date] and the Episode
72 Can be used to get a list of all episodes for a given podcast, ordered by their
73 release date.
76 Favorite Episodes by User
77 ~~~~~~~~~~~~~~~~~~~~~~~~~
78  * For each UserEpisodeState, emit [User, Podcast] and null, if the episode is
79    a favorite of the user.
81 Can be used to get the list of favorite episodes for a given user.
84 Users by Username
85 ~~~~~~~~~~~~~~~~~
86  * For each User, emit the username and the User
88 Can be used to get a user by its username.
91 Devices by User-Id
92 ~~~~~~~~~~~~~~~~~~
93  * For each User, iterate over all Devices and emit [User-Id, Device-ID]
94    and the device
96 Can be used either to get a list of all devices for a given user, or to access
97 a device given its user and ID.
100 Subscriptions by Podcast
101 ~~~~~~~~~~~~~~~~~~~~~~~~
102  * For each PodcastUserState, check existing subscriptions and emit
103    [Podcast-Id, User-Id] and null.
105 Can be used to get the subscribers for a given Podcast.
108 Subscriptions by User
109 ~~~~~~~~~~~~~~~~~~~~~
110  * For each PodcastUserState, check existing subscriptions and emit
111    [User-Id, Podcast-Id, Device-Id] and null.
113 Can be used to get the subscriptions for a given User. When queried with
114 grouped=true, group_level=2 it returns the subscribed Podcasts.
117 Suggestions by User
118 ~~~~~~~~~~~~~~~~~~~
119  * For each PodcastUserSuggestion, emit [User-Id, Podcast-Id] and null.
121 Can be used to get the suggestions for a given User.
124 PodcastUserState by User, Podcast
125 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126  * For each PodcastUserState, emit [User-Id, Podcast-Id].
128 Can be used to access PodcastUserState by User-Id and Podcast-Id.
131 PodcastUserState by User, Episode
132 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133  * For each EpisodeUserState, emit [User-Id, Episode-Id].
135  Can be used to access a EpisodeUserState by User-Id and Episode-Id.
138 Sanitizing Rules by Target
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~
140  * For each URLSanitizing Rule emit [target, priority] and the rule
141    for each target (podcast, episode) the rule can be applied to
143 Can be used to get the sanitizing rules in the intended order of application.
146 Advertisement by Time
147 ~~~~~~~~~~~~~~~~~~~~~
148  * For each Advertisement, emit the end-date and the Advertisement.
150 Can be used to get the Advertisement that will end next (ie the current or the
151 upcoming) advertisement.