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

Commit

Permalink
feat(filesys): keep doc meta info
Browse files Browse the repository at this point in the history
  • Loading branch information
felix committed Aug 27, 2019
1 parent 35cd84e commit 32d815d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gnes/indexer/fulltext/filesys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 32d815d

Please sign in to comment.