diff --git a/venra/document.py b/venra/document.py index 9b78548..3e71ca0 100644 --- a/venra/document.py +++ b/venra/document.py @@ -39,7 +39,7 @@ def _api_err_check(response): raise exceptions.VespaRequestError(err) -def _vespa_get(namespace, doctype, docid, fieldset="all"): +def _vespa_http_get(namespace, doctype, docid, fieldset="all"): """Internal wrapper for document api and http get handling""" base_uri = f"{config.vespa_host_app}/document/v1/{namespace}/{doctype}/docid/{docid}?fieldSet=[{fieldset}]" vc = client.get_vespa_client() @@ -49,7 +49,7 @@ def _vespa_get(namespace, doctype, docid, fieldset="all"): return vr -def _vespa_post(namespace, doctype, docid, doc): +def _vespa_http_post(namespace, doctype, docid, doc): """Internal wrapper for document api and http post handling""" base_uri = f"{config.vespa_host_app}/document/v1/{namespace}/{doctype}/docid/{docid}" vc = client.get_vespa_client() @@ -58,7 +58,7 @@ def _vespa_post(namespace, doctype, docid, doc): return -def _vespa_put(namespace, doctype, docid, update): +def _vespa_http_put(namespace, doctype, docid, update): """Internal wrapper for document api and http put handling""" base_uri = f"{config.vespa_host_app}/document/v1/{namespace}/{doctype}/docid/{docid}" vc = client.get_vespa_client() @@ -67,7 +67,7 @@ def _vespa_put(namespace, doctype, docid, update): return -def _vespa_delete(namespace, doctype, docid): +def _vespa_http_delete(namespace, doctype, docid): """Internal wrapper for document api and http delete handling""" base_uri = f"{config.vespa_host_app}/document/v1/{namespace}/{doctype}/docid/{docid}" vc = client.get_vespa_client() @@ -78,7 +78,7 @@ def _vespa_delete(namespace, doctype, docid): def get(namespace, doctype, docid, fieldset="all", fields_only=True): """Retrieve and return a document""" - doc = _vespa_get(namespace, doctype, docid, fieldset) + doc = _vespa_http_get(namespace, doctype, docid, fieldset) if fields_only: doc = doc["fields"] return doc @@ -87,7 +87,7 @@ def get(namespace, doctype, docid, fieldset="all", fields_only=True): def put(namespace, doctype, docid, doc): """Add or update a whole document""" doc_fields = {"fields": doc} - _vespa_post(namespace, doctype, docid, doc_fields) + _vespa_http_post(namespace, doctype, docid, doc_fields) return True @@ -111,13 +111,13 @@ def update(namespace, doctype, docid, operations): partial_update = {"fields": {}} for operation, field_name, field_value in operations: partial_update["fields"][field_name] = {operation: field_value} - _vespa_put(namespace, doctype, docid, partial_update) + _vespa_http_put(namespace, doctype, docid, partial_update) return True def remove(namespace, doctype, docid): """Delete a document""" - _vespa_delete(namespace, doctype, docid) + _vespa_http_delete(namespace, doctype, docid) return True diff --git a/venra/query.py b/venra/query.py index a05288b..2dd1dd2 100644 --- a/venra/query.py +++ b/venra/query.py @@ -34,7 +34,7 @@ def _api_err_check(response): raise exceptions.VespaRequestError(err) -def _vespa_post(qdata): +def _vespa_http_post(qdata): """Internal wrapper for search api http call handling""" base_uri = f"{config.vespa_host_app}/search/" vc = client.get_vespa_client() @@ -50,7 +50,7 @@ def search(qdata): The return val is the complete query response json loaded as a dictionary """ qstarted = time.time() - qresults = _vespa_post(qdata) + qresults = _vespa_http_post(qdata) qstopped = time.time() elapsed = qstopped - qstarted qresults["venra"] = {"elapsed_ms": elapsed} diff --git a/venra/system.py b/venra/system.py index aad6ecc..556d927 100644 --- a/venra/system.py +++ b/venra/system.py @@ -36,7 +36,7 @@ def _api_err_check(response): raise exceptions.VespaRequestError(err) -def _vespa_get(full_uri): +def _vespa_http_get(full_uri): """Internal wrapper for system api http call handling""" vc = client.get_vespa_client() vr = vc.get(f"{full_uri}") @@ -54,7 +54,7 @@ def version_app(): "version": "8.13.21" } """ - vr = _vespa_get(f"{config.vespa_host_app}/state/v1/version") + vr = _vespa_http_get(f"{config.vespa_host_app}/state/v1/version") return vr["version"] @@ -67,7 +67,7 @@ def version_cfg(): "version": "8.13.21" } """ - vr = _vespa_get(f"{config.vespa_host_cfg}/state/v1/version") + vr = _vespa_http_get(f"{config.vespa_host_cfg}/state/v1/version") return vr["version"] diff --git a/venra/visit.py b/venra/visit.py index cde0ed6..e748a74 100644 --- a/venra/visit.py +++ b/venra/visit.py @@ -24,7 +24,7 @@ def _api_err_check(response): raise exceptions.VespaRequestError(err) -def _vespa_get(namespace, doctype, selection=None, continuation=None): +def _vespa_http_get(namespace, doctype, selection=None, continuation=None): """Internal wrapper for visit api http call handling""" base_uri = f"{config.vespa_host_app}/document/v1/{namespace}/{doctype}/docid" @@ -54,7 +54,7 @@ def feed(namespace, doctype, selection=None, fields_only=True): """ # initial call - vr = _vespa_get(namespace, doctype, selection, None) + vr = _vespa_http_get(namespace, doctype, selection, None) # page through results while True: @@ -71,7 +71,7 @@ def feed(namespace, doctype, selection=None, fields_only=True): break # retrieve the next set of results - vr = _vespa_get(namespace, doctype, selection, continuation) + vr = _vespa_http_get(namespace, doctype, selection, continuation) return