Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/archive.py
Show First 20 Lines • Show All 379 Lines • ▼ Show 20 Lines | Args: | ||||
fulltext: the string pattern to search for in origin metadata | fulltext: the string pattern to search for in origin metadata | ||||
limit: the maximum number of found origins to return | limit: the maximum number of found origins to return | ||||
Returns: | Returns: | ||||
Iterable of origin metadata information for existing origins | Iterable of origin metadata information for existing origins | ||||
""" | """ | ||||
results = [] | results = [] | ||||
if search and config.get_config()["search_config"]["backend"] == "swh-search": | if ( | ||||
search | |||||
and config.get_config()["search_config"]["metadata_backend"] == "swh-search" | |||||
): | |||||
page_result = search.origin_search(metadata_pattern=fulltext, limit=limit,) | page_result = search.origin_search(metadata_pattern=fulltext, limit=limit,) | ||||
matches = idx_storage.origin_intrinsic_metadata_get( | matches = idx_storage.origin_intrinsic_metadata_get( | ||||
[r["url"] for r in page_result.results] | [r["url"] for r in page_result.results] | ||||
) | ) | ||||
else: | else: | ||||
matches = idx_storage.origin_intrinsic_metadata_search_fulltext( | matches = idx_storage.origin_intrinsic_metadata_search_fulltext( | ||||
conjunction=[fulltext], limit=limit | conjunction=[fulltext], limit=limit | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 1,019 Lines • Show Last 20 Lines |