mirror of https://github.com/apache/lucene.git
LUCENE-2533: don't return dup Strings from FileSwitchDir.listAll
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@963372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9cfb3be57f
commit
7dc191922c
|
@ -407,6 +407,10 @@ Bug fixes
|
|||
* LUCENE-2513: when opening writable IndexReader on a not-current
|
||||
commit, do not overwrite "future" commits. (Mike McCandless)
|
||||
|
||||
* LUCENE-2533: fix FileSwitchDirectory.listAll to not return dups when
|
||||
primary & secondary dirs share the same underlying directory.
|
||||
(Michael McCandless)
|
||||
|
||||
New features
|
||||
|
||||
* LUCENE-2128: Parallelized fetching document frequencies during weight
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Expert: A Directory instance that switches files between
|
||||
|
@ -76,12 +77,14 @@ public class FileSwitchDirectory extends Directory {
|
|||
|
||||
@Override
|
||||
public String[] listAll() throws IOException {
|
||||
String[] primaryFiles = primaryDir.listAll();
|
||||
String[] secondaryFiles = secondaryDir.listAll();
|
||||
String[] files = new String[primaryFiles.length + secondaryFiles.length];
|
||||
System.arraycopy(primaryFiles, 0, files, 0, primaryFiles.length);
|
||||
System.arraycopy(secondaryFiles, 0, files, primaryFiles.length, secondaryFiles.length);
|
||||
return files;
|
||||
Set<String> files = new HashSet<String>();
|
||||
for(String f : primaryDir.listAll()) {
|
||||
files.add(f);
|
||||
}
|
||||
for(String f : secondaryDir.listAll()) {
|
||||
files.add(f);
|
||||
}
|
||||
return files.toArray(new String[files.size()]);
|
||||
}
|
||||
|
||||
/** Utility method to return a file's extension. */
|
||||
|
|
Loading…
Reference in New Issue