Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 538c26b

Browse files
author
Olivier Gambier
committed
Search inclusion is conditionnal
Docker-DCO-1.1-Signed-off-by: Olivier Gambier <[email protected]> (github: dmp42)
1 parent c4ead96 commit 538c26b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

docker_registry/search.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@
1111
cfg = config.load()
1212

1313
# Enable the search index
14-
if cfg.search_backend:
15-
INDEX = index.load(cfg.search_backend.lower())
16-
else:
17-
INDEX = None
14+
INDEX = index.load(cfg.search_backend.lower())
1815

1916

2017
@app.route('/v1/search', methods=['GET'])
2118
@mirroring.source_lookup(index_route=True, merge_results=True)
2219
def get_search():
2320
search_term = flask.request.args.get('q', '')
24-
if INDEX is None:
25-
results = []
26-
else:
27-
results = INDEX.results(search_term=search_term)
21+
results = INDEX.results(search_term=search_term)
2822
return toolkit.response({
2923
'query': search_term,
3024
'num_results': len(results),

0 commit comments

Comments
 (0)