Commit 478a0d77 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed issues arround requests.args multi behaviour.

parent 69179e58
Pipeline #53033 failed with stages
in 19 minutes and 10 seconds
......@@ -24,7 +24,7 @@ from elasticsearch_dsl import Q
from elasticsearch.exceptions import NotFoundError
import datetime
from nomad import search, utils
from nomad import search
from .app import api, rfc3339DateTime
from .auth import login_if_available
......@@ -32,8 +32,6 @@ 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):
......@@ -101,9 +99,8 @@ def add_common_parameters(request_parser):
help='A yyyy-MM-ddTHH:mm:ss (RFC3339) maximum entry time (e.g. upload time)')
for quantity in search.search_quantities.values():
print('## %s: %s' % (quantity.name, quantity.multi))
request_parser.add_argument(
quantity.name, type=str, help=quantity.description,
quantity.name, help=quantity.description,
action='append' if quantity.multi else None)
......@@ -155,9 +152,9 @@ def create_owner_query():
def create_search_parameters():
""" Helper that creates a request.args dict with isolated search parameters """
logger.debug('create search parameter', request_args=str(dict(**request.args)))
search_parameters = dict(**request.args)
search_parameters = {
key: request.args.getlist(key) if search.search_quantities[key] else request.args.get(key)
for key in request.args.keys()}
search_parameters.pop('owner', None)
search_parameters.pop('scroll', None)
search_parameters.pop('scroll_id', None)
......@@ -257,7 +254,6 @@ 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:
......
......@@ -27,8 +27,6 @@ from datetime import datetime
from nomad import config, datamodel, infrastructure, datamodel, coe_repo, utils
logger = utils.get_logger(__name__)
path_analyzer = analyzer(
'path_analyzer',
tokenizer=tokenizer('path_tokenizer', 'pattern', pattern='/'))
......@@ -284,9 +282,7 @@ def _execute_paginated_search(
search = search.sort('-%s' % order_by_quantity.elastic_field)
paginated_search = search[(page - 1) * per_page: page * per_page]
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(response.to_dict()))
total_results = response.hits.total
search_results = [hit.to_dict() for hit in response.hits]
......
......@@ -2,7 +2,7 @@ proxy:
nodePort: 30011
external:
host: "repository.nomad-coe.eu"
path: "/uploads"
path: "/fairdi/nomad/prod"
api:
disableReset: false
......@@ -22,7 +22,7 @@ postgres:
user: 'nomadrep'
password_secret: 'nomad-production-repository-password'
uploadurl: 'https://repository.nomad-coe.eu/uploads/upload'
uploadurl: 'https://repository.nomad-coe.eu/fairdi/nomad/prod/gui/upload'
volumes:
prefixSize: 1
......
export NOMAD_CLIENT_URL=https://repository.nomad-coe.eu/uploads/api
export NOMAD_CLIENT_URL=https://labdev-nomad.esc.rzg.mpg.de/fairdi/nomad/prod/api
export NOMAD_CLIENT_USER=admin
export NOMAD_MONGO_DB_NAME=fairdi_nomad_prod
export NOMAD_ELASTIC_INDEX_NAME=fairdi_nomad_prod
export NOMAD_FS_LOCAL_TMP=/nomad/fairdi/prod/fs/tmp
export NOMAD_FS_STAGING=/nomad/fairdi/prod/fs/staging
export NOMAD_FS_PUBLIC=/nomad/fairdi/prod/fs/public
export NOMAD_FS_TMP=/nomad/fairdi/prod/fs/tmp
\ No newline at end of file
export NOMAD_FS_TMP=/nomad/fairdi/prod/fs/tmp
......@@ -753,7 +753,7 @@ class TestRepo():
(0, 'system', 'atom'),
(1, 'atoms', 'Br'),
(1, 'atoms', 'Fe'),
(0, 'atoms', ['Fe', 'Br']),
(0, 'atoms', ['Fe', 'Br', 'A', 'B']),
(0, 'only_atoms', ['Br', 'Si']),
(1, 'only_atoms', ['Fe']),
(1, 'only_atoms', ['Br', 'K', 'Si']),
......
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