Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
fix(indexer): fix parsing in DictIndexer
  • Loading branch information
hanhxiao committed Aug 27, 2019
1 parent a735a71 commit f49f9a5b5b8b61501f2d07768e2938d06d29a22b
Showing with 4 additions and 1 deletion.
  1. +1 −1 gnes/indexer/fulltext/
  2. +3 −0 tests/
@@ -16,7 +16,7 @@ def add(self, keys: List[int], docs: List['gnes_pb2.Document'], *args, **kwargs)
self._content.update({k: MessageToJson(d) for (k, d) in zip(keys, docs)})

def query(self, keys: List[int], *args, **kwargs) -> List['gnes_pb2.Document']:
return [Parse(self._content[k], gnes_pb2.Document) for k in keys]
return [Parse(self._content[k], gnes_pb2.Document()) for k in keys]

def size(self):
@@ -4,6 +4,7 @@

from gnes.indexer.fulltext.dict import DictIndexer
from gnes.indexer.fulltext.leveldb import LVDBIndexer
from gnes.proto import gnes_pb2
from tests import txt_file2pb_docs

@@ -40,6 +41,8 @@ def test_dict_indexer(self):
db3 = DictIndexer.load_yaml(db.yaml_full_path)
for k in db3.query([1, 2, 3]):
self.assertIsInstance(k, gnes_pb2.Document)
self.assertEqual(len(self.test_docs), db3.size)

def test_add_docs(self):

0 comments on commit f49f9a5

Please sign in to comment.