Adds a new check level WARNING because missing wikipedia importances
are not necessarily an error. If the database is run for reverse
requests only, then it is fine to go without them.
FAIL = 1
FATAL = 2
NOT_APPLICABLE = 3
FAIL = 1
FATAL = 2
NOT_APPLICABLE = 3
def _check(hint=None):
""" Decorator for checks. It adds the function to the list of
def _check(hint=None):
""" Decorator for checks. It adds the function to the list of
params = {}
if ret == CheckState.OK:
print('\033[92mOK\033[0m')
params = {}
if ret == CheckState.OK:
print('\033[92mOK\033[0m')
+ elif ret == CheckState.WARN:
+ print('\033[93mWARNING\033[0m')
+ if hint:
+ print('')
+ print(dedent(hint.format(**params)))
elif ret == CheckState.NOT_APPLICABLE:
print('not applicable')
else:
elif ret == CheckState.NOT_APPLICABLE:
print('not applicable')
else:
return CheckState.FAIL, dict(msg=result)
return CheckState.FAIL, dict(msg=result)
+@_check(hint="""\
+ Wikipedia/Wikidata importance tables missing.
+ Quality of search results may be degraded. Reverse geocoding is unaffected.
+ See https://nominatim.org/release-docs/latest/admin/Import/#wikipediawikidata-rankings
+ """)
+def check_existance_wikipedia(conn, _):
+ """ Checking for wikipedia/wikidata data
+ """
+ with conn.cursor() as cur:
+ cnt = cur.scalar('SELECT count(*) FROM wikipedia_article')
+
+ return CheckState.WARN if cnt == 0 else CheckState.OK
+
+
@_check(hint="""\
The indexing didn't finish. {count} entries are not yet indexed.
@_check(hint="""\
The indexing didn't finish. {count} entries are not yet indexed.