Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/service.py
Show First 20 Lines • Show All 255 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 | ||||
offset: number of found origins to skip before returning results | offset: number of found origins to skip before returning results | ||||
limit: the maximum number of found origins to return | limit: the maximum number of found origins to return | ||||
Returns: | Returns: | ||||
list of origin metadata as dict. | list of origin metadata as dict. | ||||
""" | """ | ||||
results = idx_storage.origin_intrinsic_metadata_search_fulltext( | matches = idx_storage.origin_intrinsic_metadata_search_fulltext( | ||||
conjunction=[fulltext], limit=limit) | conjunction=[fulltext], limit=limit) | ||||
for result in results: | results = [] | ||||
result['from_revision'] = hashutil.hash_to_hex(result['from_revision']) | for match in matches: | ||||
match['from_revision'] = hashutil.hash_to_hex(match['from_revision']) | |||||
result = converters.from_origin( | |||||
storage.origin_get({'id': match.pop('origin_id')})) | |||||
result['metadata'] = match | |||||
results.append(result) | |||||
return results | return results | ||||
def lookup_person(person_id): | def lookup_person(person_id): | ||||
"""Return information about the person with id person_id. | """Return information about the person with id person_id. | ||||
Args: | Args: | ||||
person_id as string | person_id as string | ||||
▲ Show 20 Lines • Show All 756 Lines • Show Last 20 Lines |