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

Commit

Permalink
fix(indexer): fix bug for indexer service dealing with empty doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng committed Jul 26, 2019
1 parent 1dff06f commit ded92c5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions gnes/service/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ def _handler_index(self, msg: 'gnes_pb2.Message'):
weights = []

for d in msg.request.index.docs:
all_vecs.append(blob2array(d.chunk_embeddings))
doc_ids += [d.doc_id] * len(d.chunks)
if msg.request.index.docs.doc_type == 'TEXT':
offsets += [c.offset_1d for c in d.chunks]
elif msg.request.index.docs.doc_type == 'IMAGE':
offsets += [c.offset_nd for c in d.chunks]
elif msg.request.index.docs.doc_type == 'VIDEO':
offsets += [c.offset_1d for c in d.chunks]
weights += [c.weight for c in d.chunks]
if d.chunks:
all_vecs.append(blob2array(d.chunk_embeddings))
doc_ids += [d.doc_id] * len(d.chunks)
if msg.request.index.docs.doc_type == 'TEXT':
offsets += [c.offset_1d for c in d.chunks]
elif msg.request.index.docs.doc_type == 'IMAGE':
offsets += [c.offset_nd for c in d.chunks]
elif msg.request.index.docs.doc_type == 'VIDEO':
offsets += [c.offset_1d for c in d.chunks]
weights += [c.weight for c in d.chunks]

from ..indexer.base import BaseVectorIndexer, BaseTextIndexer
if isinstance(self._model, BaseVectorIndexer):
Expand Down

0 comments on commit ded92c5

Please sign in to comment.