Changeset View
Changeset View
Standalone View
Standalone View
swh/search/interface.py
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | class SearchInterface: | ||||||||||||
@remote_api_endpoint("origin/search") | @remote_api_endpoint("origin/search") | ||||||||||||
def origin_search( | def origin_search( | ||||||||||||
self, | self, | ||||||||||||
*, | *, | ||||||||||||
url_pattern: Optional[str] = None, | url_pattern: Optional[str] = None, | ||||||||||||
metadata_pattern: Optional[str] = None, | metadata_pattern: Optional[str] = None, | ||||||||||||
with_visit: bool = False, | with_visit: bool = False, | ||||||||||||
visit_types: Optional[List[str]] = None, | visit_types: Optional[List[str]] = None, | ||||||||||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | ||||||||||||
min_nb_visit: int = None, | |||||||||||||
vlorentz: It's unclear from the names they will returns visits *after* the given values (rather than… | |||||||||||||
Done Inline ActionsActually, I thought of only going for equality because at the moment these two parameters are only used in tests for the atomic merges and later they'll be replaced with the query parser. In the query, users can specify < or > and Elasticsearch queries will be generated accordingly. So can I keep it as it is ?
Sure. KShivendu: Actually, I thought of only going for `equality` because at the moment these two parameters are… | |||||||||||||
Not Done Inline ActionsThe point of having them here is to be able to use them even outside tests while we are working on the query language. Otherwise we would just use origin_dump in tests. vlorentz: The point of having them here is to be able to use them even outside tests while we are working… | |||||||||||||
min_last_visit_date: str = None, | |||||||||||||
limit: int = 50, | limit: int = 50, | ||||||||||||
) -> PagedResult[MinimalOriginDict]: | ) -> PagedResult[MinimalOriginDict]: | ||||||||||||
"""Searches for origins matching the `url_pattern`. | """Searches for origins matching the `url_pattern`. | ||||||||||||
Args: | Args: | ||||||||||||
url_pattern: Part of the URL to search for | url_pattern: Part of the URL to search for | ||||||||||||
with_visit: Whether origins with no visit are to be | with_visit: Whether origins with no visit are to be | ||||||||||||
filtered out | filtered out | ||||||||||||
visit_types: Only origins having any of the provided visit types | visit_types: Only origins having any of the provided visit types | ||||||||||||
(e.g. git, svn, pypi) will be returned | (e.g. git, svn, pypi) will be returned | ||||||||||||
page_token: Opaque value used for pagination | page_token: Opaque value used for pagination | ||||||||||||
min_nb_visit: Filter origins that have number of visits >= | |||||||||||||
the provided value | |||||||||||||
min_last_visit_date: Filter origins that have | |||||||||||||
Not Done Inline Actions
vlorentz: | |||||||||||||
last_visit_date on or after the provided date(ISO format) | |||||||||||||
limit: number of results to return | limit: number of results to return | ||||||||||||
Returns: | Returns: | ||||||||||||
PagedResult of origin dicts matching the search criteria. If next_page_token | PagedResult of origin dicts matching the search criteria. If next_page_token | ||||||||||||
is None, there is no longer data to retrieve. | is None, there is no longer data to retrieve. | ||||||||||||
""" | """ | ||||||||||||
... | ... |
It's unclear from the names they will returns visits *after* the given values (rather than equal).
Could you rename the parameters and document them in the docstring?