remove unnecessary mapping to TagSpecificBaseDir
This commit is contained in:
@@ -27,26 +27,6 @@ public class TagsToFile implements AutoCloseable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TagsToFile.class);
|
||||
|
||||
private static class TagSpecificBaseDir {
|
||||
private final Path path;
|
||||
|
||||
private final Tags tags;
|
||||
|
||||
public TagSpecificBaseDir(final Path path, final Tags tags) {
|
||||
super();
|
||||
this.path = path;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Path getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Tags getTags() {
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
||||
private static class WriterCache {
|
||||
final List<PdbWriter> writers = new ArrayList<>();
|
||||
|
||||
@@ -98,24 +78,7 @@ public class TagsToFile implements AutoCloseable {
|
||||
|
||||
public List<PdbFile> getFilesForQuery(final String query) {
|
||||
final List<PdbFile> result = new ArrayList<>();
|
||||
final List<TagSpecificBaseDir> tagSpecificFolders = getTagSpecificFolders(query);
|
||||
|
||||
for (final TagSpecificBaseDir tagSpecific : tagSpecificFolders) {
|
||||
|
||||
final Tags fileSpecificTags = tagSpecific.getTags();
|
||||
|
||||
final Path storageFile = tagSpecific.getPath();
|
||||
final PdbFile pdbFile = new PdbFile(storageFile, fileSpecificTags);
|
||||
|
||||
result.add(pdbFile);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<TagSpecificBaseDir> getTagSpecificFolders(final String query) {
|
||||
final List<TagSpecificBaseDir> result = new ArrayList<>();
|
||||
|
||||
|
||||
final List<Doc> searchResult = db.search(query);
|
||||
if (searchResult.size() > 100_000){
|
||||
throw new IllegalStateException("Too many results.");
|
||||
@@ -125,8 +88,9 @@ public class TagsToFile implements AutoCloseable {
|
||||
|
||||
final Path path = document.getPath();
|
||||
final Tags tags = document.getTags();
|
||||
final PdbFile pdbFile = new PdbFile(path, tags);
|
||||
|
||||
result.add(new TagSpecificBaseDir(path, tags));
|
||||
result.add(pdbFile);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user