Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/archive.py
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | else: | ||||
conjunction=[fulltext], limit=limit | conjunction=[fulltext], limit=limit | ||||
) | ) | ||||
matches = [match.to_dict() for match in matches] | matches = [match.to_dict() for match in matches] | ||||
origins = storage.origin_get([match["id"] for match in matches]) | origins = storage.origin_get([match["id"] for match in matches]) | ||||
for origin, match in zip(origins, matches): | for origin, match in zip(origins, matches): | ||||
if not origin: | if not origin: | ||||
continue | continue | ||||
match["from_directory"] = hashutil.hash_to_hex(match["from_directory"]) | for field in ("from_directory", "from_revision"): | ||||
# from_directory when using swh.indexer >= 2.0.0, from_revision otherwise | |||||
if field in match: | |||||
match[field] = hashutil.hash_to_hex(match[field]) | |||||
del match["id"] | del match["id"] | ||||
results.append(OriginMetadataInfo(url=origin.url, metadata=match)) | results.append(OriginMetadataInfo(url=origin.url, metadata=match)) | ||||
return results | return results | ||||
def lookup_origin_intrinsic_metadata(origin_url: str) -> Dict[str, Any]: | def lookup_origin_intrinsic_metadata(origin_url: str) -> Dict[str, Any]: | ||||
"""Return intrinsic metadata for origin whose origin matches given | """Return intrinsic metadata for origin whose origin matches given | ||||
▲ Show 20 Lines • Show All 1,026 Lines • Show Last 20 Lines |