Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(service): indexer service return empty when no chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Sep 5, 2019
1 parent 00e6280 commit e631d39
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gnes/service/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e631d39

Please sign in to comment.