Map search added to global search. Preview cards are displayed for all results in new Map tab.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

Map viewer has simple search.

Map search databases can be downloaded from CDN, or built locally. Map searches can be built offline, but will not have enriched things like state names downloaded from Wikidata.
This commit is contained in:
Roland 2026-04-11 20:09:30 -06:00
parent aaa3c0aff7
commit c726654de9
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
21 changed files with 1831 additions and 62 deletions

View file

@ -33,13 +33,16 @@ def get_pmtiles_files() -> List[dict]:
path=str(path.relative_to(get_media_directory())),
size=stat.st_size,
mtime=stat.st_mtime,
has_search_index=path.with_suffix('.search.db').is_file(),
))
return files
def delete_pmtiles_file(filename: str) -> bool:
"""Delete a PMTiles file from the map directory. Returns True if the file was deleted."""
"""Delete a PMTiles file from the map directory. Returns True if the file was deleted.
Also deletes the companion .search.db file if it exists."""
map_directory = get_map_directory()
# Prevent path traversal.
path = (map_directory / filename).resolve()
@ -49,6 +52,11 @@ def delete_pmtiles_file(filename: str) -> bool:
if path.is_file() and path.suffix == '.pmtiles':
path.unlink()
logger.warning(f'Deleted PMTiles file: {path}')
# Also delete companion search index.
search_db = path.with_suffix('.search.db')
if search_db.is_file():
search_db.unlink()
logger.warning(f'Deleted search index: {search_db}')
return True
return False
@ -73,7 +81,6 @@ def _get_or_create_map_download(session: Session) -> Download:
download = download_manager.get_or_create_download(session, MANIFEST_URL, reset_attempts=True,
override_skip=True)
download.downloader = 'map_catalog'
download.sub_downloader = 'map_extract'
download.frequency = DownloadFrequency.days180
download.settings = {'regions': []}
download.location = '/map/manage'