This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
299 lines (275 loc) · 10.3 KB
/
settings.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
SECRET_KEY = ''
# URL of the ElasticSearch instance that contains the AVResearcher
# broadcasts index
ES_SEARCH_HOST = 'localhost'
ES_SEARCH_PORT = 9200
ES_SEARCH_URL_PREFIX = ''
ES_SEARCH_INDEX = 'avresearcher'
# URL of the ElasticSearch instance used to store usage logs (clicks,
# queries, etc.)
ES_LOG_HOST = ES_SEARCH_HOST
ES_LOG_PORT = ES_SEARCH_PORT
ES_LOG_URL_PREFIX = ES_SEARCH_URL_PREFIX
ES_LOG_INDEX = 'avresearcher_logs'
# User database URI
DATABASE_URI = 'mysql://user:pass@host/db'
# Email settings (used for account activation and user approval)
MAIL_SERVER = 'localhost'
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = None
MAIL_PASSWORD = None
MAIL_DEFAULT_SENDER = ('AVResearcher', '[email protected]')
MAIL_REGISTRATION_SUBJECT = 'Thanks for creating an AVResearcher account'
MAIL_ACCOUNT_APPROVAL_ADDRESS = ''
# Human-readable messages send by the API
MESSAGES = {
'missing_name': 'Please enter your name',
'missing_email': 'Please enter an email address',
'invalid_email': 'The email address you entered seems te be invalid',
'missing_password': 'Please enter your password',
'account_already_exists': 'There already exists an account with this email'
' address',
'email_verification_subject': 'Thanks for creating an AVResearcher account',
'email_verification_body': 'Dear %s,\n\nThank you for creating an '
'AVResearcher account.\n\nTo verify your email '
'address, please click the following link:'
' %s. After verification, a member of the '
'AVResearcher team will grant you access to the'
' AVResearcher application. You will be notified'
' by email as soon as your account is approved.'
'\n\nRegards,\nThe AVResearcher team',
'email_approval_subject': '[AVResearcher] New user registration',
'email_approval_body': 'The following user registered a new AVResearcher '
'account:\n\nName: %s\nOrganization: %s\nEmail '
'address: %s\n\nClick the following link to approve '
'this registration and grant the user access to the '
'application: %s',
'email_approved_subject': 'Your AVResearcher account is approved',
'email_approved_body': 'Dear %s,\n\nYour AVResearcher account is approved '
'and activated.\n\nTo start using the AVResearcher '
'visit: %s\n\nRegards,\nThe AVResearcher team',
'invalid_email_or_password': 'Incorrect email or password',
'email_not_verified': 'You did not yet verifiy your email address. Please '
'click the link in the email you recieved.',
'account_not_approved': 'Your account first needs to be approved by a '
'member of the AVResearcher team. You will recieve'
' an email as soon as permission is granted to use '
'the application.',
'email_verified_title': 'Hi %s, thanks for verifying your mail address',
'email_verified_content': 'A member of the AVResearcher team will review '
'your application. You will be notified by '
'email as soon as your account is approved.',
'user_approved_title': '%s can now login to the application',
'login_failed': 'Incorrect email or password',
'login_required': 'You must be logged in to use this function'
}
HITS_PER_PAGE = 5
ALLOWED_INTERVALS = ['year', 'month', 'week', 'day']
AVAILABLE_FACETS = {
'broadcast_start_date': {
'name': 'Start Date',
'description': '',
'ui_presentation': 'range',
'date_histogram': {
'field': 'start',
'interval': 'year' # allowed values are ['year', 'month', 'week', 'day']
},
'nested': 'broadcastDates'
},
'channels': {
'name': 'Channels',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'broadcasters',
'size': 30
}
},
'producers': {
'name': 'Producers',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'roleValue',
'size': 30
},
'facet_filter': {
'term': {'roleKey': 'producent'}
},
'nested': 'roles'
},
'people': {
'name': 'People',
'description': '',
'ui_presentation': 'checkbox',
'nested_filter_field': 'categoryValue',
'terms': {
'field': 'untouched',
'size': 30
},
'facet_filter': {
'term': {'categoryKey': 'person'}
},
'nested': 'categories'
# 'terms': {
# 'field': 'roleValue',
# 'size': 30
# },
# 'facet_filter' : {
# 'or': [
# {'term': {'roleKey': 'maker'}},
# {'term': {'roleKey': 'executive'}},
# {'term': {'roleKey': 'speaker'}}
# ]
# },
# 'nested': 'roles'*/
},
'genres': {
'name': 'Genres',
'description': '',
'ui_presentation': 'checkbox',
'nested_filter_field': 'categoryValue',
'terms': {
'field': 'untouched',
'size': 30
},
'facet_filter': {
'term': {
'categoryKey': 'genre'
}
},
'nested': 'categories'
},
'keywords': {
'name': 'Keywords',
'description': '',
'ui_presentation': 'checkbox',
'nested_filter_field': 'categoryValue',
'terms': {
'field': 'untouched',
'size': 30
},
'facet_filter': {
'term': {'categoryKey': 'keyword'}
},
'nested': 'categories'
},
# This facet operates on the complete set of Twitter terms, but can be
# very memory expensive (every term present in the text has to be kept
# in memory)
'tweets': {
'name': 'Tweets',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'tweetText',
'size': 30
},
'nested': 'tweets'
},
# This facet operates on a list of the top 100 terms extracted from Tweets
# (generated in whatever way; that is up to the indexer), as to economize
# on memory usage
'top_100_twitter_terms': {
'name': 'Tweets',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'top_100_twitter_terms',
'size': 30
}
},
# This facet operates on the complete set of subtitle terms, but can be
# very memory expensive (every term present in the text has to be kept
# in memory)
'subtitles': {
'name': 'Subtitles',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'subtitles',
'size': 30
}
},
# This facet operates on a list of the top 100 terms extracted from subtitles
# (generated in whatever way; that is up to the indexer), as to economize
# on memory usage
'top_100_subtitle_terms': {
'name': 'Subtitles',
'description': '',
'ui_presentation': 'checkbox',
'terms': {
'field': 'top_100_subtitle_terms',
'size': 30
}
}
}
# List of facets that are displayed (in the different tabs) by default
DEFAULT_FACETS = ['genres', 'channels', 'producers', 'keywords', 'people',
'tweets', 'subtitles']
# The facet that is used for the date range slider
DEFAULT_DATE_FACET = 'broadcast_start_date'
# Defenition of sources/fields that can be used for free text searching
AVAILABLE_SEARCH_FIELDS = [
{
'id': 'immix',
'name': 'iMMix metadata',
'icon': 'icon-film',
'fields': ['titles', 'mainTitle', 'summaries', 'descriptions']
},
{
'id': 'subtitles',
'name': 'T888 subtitles',
'icon': 'icon-comment',
'fields': ['subtitles']
},
{
'id': 'twitter',
'name': 'Tweets',
'icon': 'icon-twitter',
'fields': ['tweetText'],
'nested': 'tweets'
}
]
# The fields that should be returned for each hit when searching
SEARCH_HIT_FIELDS = ['mainTitle', 'broadcastDates', 'summaries']
MINIMUM_CLOUD_FONTSIZE = 10
MAXIMUM_CLOUD_FONTSIZE = 30
BARCHART_BARS = 10
BARCHART_BAR_HEIGHT = 20
# The fields that should be considered when creating highlighted snippets for
# a search result.
HIT_HIGHLIGHT_FIELDS = ['descriptions', 'summaries', 'subtitles', 'tweetText']
# The max. length of a highlighted snippet (in chars)
HIT_HIGHLIGHT_FRAGMENT_SIZE = 200
# The max. number of highlighted snippets (per field) to return
HIT_HIGHLIGHT_FRAGMENTS = 1
# Enables or disables application usage logging
ENABLE_USAGE_LOGGING = True
# Determine which events will be logged
# clicks actions:
# submit_query: User submits a new query. Log querystring and modelName.
# change_search_field: User adds or removes one of the collections from the search. Log modelName, the collection, and whether it has been activated or not
# daterange_facet: User uses timeslider. Log from date in ms, to date in ms, and the model name
# change_facet_tab: User switches tabs in facetsview. Log source and target tab
# view_document: User clicks on a single document in result list. Log document id and model name
# page_switch: User switches between home, about and querysyntax page. Log source and target page.
# results actions:
# results: A result list is rendered. Log the visible doc_ids and model name.
LOG_EVENTS = ['clicks', 'results']
# The URL to the JSON file that contains the (textual) information
# displayed on the 'about' page
ABOUT_PAGE_CONTENT_URL = 'static/about.json'
# URL to JSON file that contains text for 'help' page
HELP_PAGE_CONTENT_URL = 'static/help.json'
# Allow all settings to be overridden by a local file that is not in
# the VCS.
try:
from local_settings import *
except ImportError:
pass