reduce memory footprint by lazily intializing the path in Doc
The path in Doc is not optional. This reduces memory consumption, because we only have to store a long (the offset in the listing file). This assumes, that only a small percentage of Docs is requested.
This commit is contained in:
@@ -15,6 +15,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.datastore.Doc;
|
||||
import org.lucares.pdb.datastore.FolderStoragePathResolver;
|
||||
import org.lucares.pdb.datastore.PdbDB;
|
||||
import org.lucares.utils.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -70,7 +71,8 @@ public class TagsToFile implements AutoCloseable {
|
||||
final List<PdbFile> result = new ArrayList<>();
|
||||
for (final Doc document : searchResult) {
|
||||
|
||||
final Path path = document.getPath();
|
||||
final FolderStoragePathResolver resolver = db.getFolderStoragePathResolver();
|
||||
final Path path = document.getPath(resolver);
|
||||
final Tags tags = document.getTags();
|
||||
final PdbFile pdbFile = new PdbFile(path, tags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user