mirror of https://github.com/apache/lucene.git
fix test to stop if indexing threads hits an exception
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1466714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24376b1bd7
commit
ffa48dd967
|
@ -54,42 +54,45 @@ public class TestSearcherTaxonomyManager extends LuceneTestCase {
|
||||||
Thread indexer = new Thread() {
|
Thread indexer = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Set<String> seen = new HashSet<String>();
|
try {
|
||||||
List<String> paths = new ArrayList<String>();
|
Set<String> seen = new HashSet<String>();
|
||||||
while (true) {
|
List<String> paths = new ArrayList<String>();
|
||||||
Document doc = new Document();
|
while (true) {
|
||||||
List<CategoryPath> docPaths = new ArrayList<CategoryPath>();
|
Document doc = new Document();
|
||||||
int numPaths = _TestUtil.nextInt(random(), 1, 5);
|
List<CategoryPath> docPaths = new ArrayList<CategoryPath>();
|
||||||
for(int i=0;i<numPaths;i++) {
|
int numPaths = _TestUtil.nextInt(random(), 1, 5);
|
||||||
String path;
|
for(int i=0;i<numPaths;i++) {
|
||||||
if (!paths.isEmpty() && random().nextInt(5) != 4) {
|
String path;
|
||||||
// Use previous path
|
if (!paths.isEmpty() && random().nextInt(5) != 4) {
|
||||||
path = paths.get(random().nextInt(paths.size()));
|
// Use previous path
|
||||||
} else {
|
path = paths.get(random().nextInt(paths.size()));
|
||||||
// Create new path
|
} else {
|
||||||
path = null;
|
// Create new path
|
||||||
while (true) {
|
path = null;
|
||||||
path = _TestUtil.randomRealisticUnicodeString(random());
|
while (true) {
|
||||||
if (path.length() != 0 && !seen.contains(path) && path.indexOf(FacetIndexingParams.DEFAULT_FACET_DELIM_CHAR) == -1) {
|
path = _TestUtil.randomRealisticUnicodeString(random());
|
||||||
seen.add(path);
|
if (path.length() != 0 && !seen.contains(path) && path.indexOf(FacetIndexingParams.DEFAULT_FACET_DELIM_CHAR) == -1) {
|
||||||
paths.add(path);
|
seen.add(path);
|
||||||
break;
|
paths.add(path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
docPaths.add(new CategoryPath("field", path));
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
facetFields.addFields(doc, docPaths);
|
||||||
|
w.addDocument(doc);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new RuntimeException(ioe);
|
||||||
}
|
}
|
||||||
docPaths.add(new CategoryPath("field", path));
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
facetFields.addFields(doc, docPaths);
|
|
||||||
w.addDocument(doc);
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
throw new RuntimeException(ioe);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tw.getSize() >= ordLimit) {
|
if (tw.getSize() >= ordLimit) {
|
||||||
stop.set(true);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
stop.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue