Commit 6a594683 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

More debug logs for search API.

parent 33976c01
Pipeline #53030 failed with stages
in 15 minutes and 44 seconds
......@@ -24,7 +24,7 @@ from elasticsearch_dsl import Q
from elasticsearch.exceptions import NotFoundError
import datetime
from nomad import search
from nomad import search, utils
from .app import api, rfc3339DateTime
from .auth import login_if_available
......@@ -32,6 +32,8 @@ from .common import pagination_model, pagination_request_parser, calc_route
ns = api.namespace('repo', description='Access repository metadata.')
logger = utils.get_logger(__name__)
@calc_route(ns)
class RepoCalcResource(Resource):
......@@ -252,6 +254,7 @@ class RepoCalcsResource(Resource):
q = q & without_currupted_mainfile if q is not None else without_currupted_mainfile
search_parameters = create_search_parameters()
logger.debug('repo search', search_parameters=str(search_parameters))
try:
if scroll:
......
......@@ -286,7 +286,7 @@ def _execute_paginated_search(
logger.debug('search request', search_request=str(paginated_search.to_dict()))
response = paginated_search.execute() # pylint: disable=E1101
logger.debug('search response', search_request=str(paginated_search.to_dict()))
logger.debug('search response', search_request=str(response.to_dict()))
total_results = response.hits.total
search_results = [hit.to_dict() for hit in response.hits]
......
......@@ -26,7 +26,7 @@ import os.path
from urllib.parse import urlencode
from nomad.api.app import rfc3339DateTime
from nomad import coe_repo, search, parsing, files, config
from nomad import coe_repo, search, parsing, files, config, utils
from nomad.files import UploadFiles, PublicUploadFiles
from nomad.processing import Upload, Calc, SUCCESS
from nomad.datamodel import UploadWithMetadata, CalcWithMetadata
......@@ -38,6 +38,8 @@ from tests.test_coe_repo import assert_coe_upload
from tests.test_search import assert_search_upload
logger = utils.get_logger(__name__)
def test_alive(client):
rv = client.get('/alive')
assert rv.status_code == 200
......@@ -767,6 +769,7 @@ class TestRepo():
query_string = urlencode({quantity: value}, doseq=True)
rv = client.get('/repo/?%s' % query_string, headers=test_user_auth)
logger.debug('run search quantities test', query_string=query_string)
data = self.assert_search(rv, calcs)
quantities = data.get('quantities', None)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment