Skip to content
Permalink
Browse files

fix(service): indexer service return empty when no chunk

  • Loading branch information...
hanxiao committed Sep 5, 2019
1 parent 00e6280 commit e631d3963601e66d347e65ac7c1a5afbcf0f9562
Showing with 6 additions and 1 deletion.
  1. +6 −1 gnes/service/indexer.py
@@ -76,7 +76,12 @@ def _handler_chunk_search(self, msg: 'gnes_pb2.Message'):
raise ServiceError(
'unsupported indexer, dont know how to use %s to handle this message' % self._model.__bases__)

results = self._model.query_and_score(msg.request.search.query.chunks, top_k=msg.request.search.top_k)
results = []
if not msg.request.search.query.chunks:
self.logger.warning('query contains no chunks!')
else:
results = self._model.query_and_score(msg.request.search.query.chunks, top_k=msg.request.search.top_k)

self._put_result_into_message(results, msg)

@handler.register(gnes_pb2.Response.QueryResponse)

0 comments on commit e631d39

Please sign in to comment.
You can’t perform that action at this time.