mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-18 02:21:55 +03:00
add check for wikipedia importance data
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.
This commit is contained in:
parent
37e5f07d83
commit
8bcdba1a14
@ -23,6 +23,7 @@ class CheckState(Enum):
|
|||||||
FAIL = 1
|
FAIL = 1
|
||||||
FATAL = 2
|
FATAL = 2
|
||||||
NOT_APPLICABLE = 3
|
NOT_APPLICABLE = 3
|
||||||
|
WARN = 4
|
||||||
|
|
||||||
def _check(hint=None):
|
def _check(hint=None):
|
||||||
""" Decorator for checks. It adds the function to the list of
|
""" Decorator for checks. It adds the function to the list of
|
||||||
@ -40,6 +41,11 @@ def _check(hint=None):
|
|||||||
params = {}
|
params = {}
|
||||||
if ret == CheckState.OK:
|
if ret == CheckState.OK:
|
||||||
print('\033[92mOK\033[0m')
|
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:
|
elif ret == CheckState.NOT_APPLICABLE:
|
||||||
print('not applicable')
|
print('not applicable')
|
||||||
else:
|
else:
|
||||||
@ -180,6 +186,20 @@ def check_tokenizer(_, config):
|
|||||||
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="""\
|
@_check(hint="""\
|
||||||
The indexing didn't finish. {count} entries are not yet indexed.
|
The indexing didn't finish. {count} entries are not yet indexed.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user