Changeset View
Changeset View
Standalone View
Standalone View
swh/search/api/server.py
# Copyright (C) 2019 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import logging | import logging | ||||
import os | import os | ||||
from swh.core import config | from swh.core import config | ||||
from swh.core.api import RPCServerApp, error_handler, encode_data_server as encode_data | from swh.core.api import RPCServerApp, error_handler, encode_data_server as encode_data | ||||
from .. import get_search | from .. import get_search | ||||
from ..elasticsearch import ElasticSearch | from ..elasticsearch import ElasticSearch | ||||
vlorentz: for consistency with the import above: `from .serializers import ENCODERS, DECODERS` | |||||
def _get_search(): | def _get_search(): | ||||
global search | global search | ||||
if not search: | if not search: | ||||
search = get_search(**app.config["search"]) | search = get_search(**app.config["search"]) | ||||
return search | return search | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |
for consistency with the import above: from .serializers import ENCODERS, DECODERS