Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
feat(filesys): keep doc meta info
  • Loading branch information
felix committed Aug 27, 2019
1 parent 35cd84e commit 32d815d7ef40a2e6629e95ee358e6898b2ee9d39
Showing with 4 additions and 0 deletions.
  1. +4 −0 gnes/indexer/fulltext/filesys.py
@@ -46,6 +46,10 @@ def add(self, keys: List[int], docs: List['gnes_pb2.Document'], *args, **kwargs)
dirs = os.path.join(self.data_path, str(k))
if not os.path.exists(dirs):
os.makedirs(dirs)
# keep doc meta in .meta file
with open(os.path.join(dirs, '.meta'), 'wb') as f:
f.write(d.meta)

for i, chunk in enumerate(d.chunks):
with open(os.path.join(dirs, '%d.%s' % (i, self.file_suffix)), 'wb') as f:
f.write(chunk.raw)

0 comments on commit 32d815d

Please sign in to comment.