Github user cbismuth commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/497#discussion_r232780211
--- Diff:
lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java
---
@@ -152,13 +150,130 @@ public void testExitableFilterIndexReader() throws
Exception {
// Set a negative time allowed and expect the query to complete
(should disable timeouts)
// Not checking the validity of the result, all we are bothered about
in this test is the timing out.
directoryReader = DirectoryReader.open(directory);
- exitableDirectoryReader = new ExitableDirectoryReader(directoryReader,
new QueryTimeoutImpl(-189034L));
+ exitableDirectoryReader = new ExitableDirectoryReader(directoryReader,
disabledQueryTimeout());
reader = new TestReader(getOnlyLeafReader(exitableDirectoryReader));
searcher = new IndexSearcher(reader);
searcher.search(query, 10);
reader.close();
directory.close();
}
+
+ /**
+ * Tests timing out of PointValues queries
+ *
+ * @throws Exception on error
+ */
+ public void testExitablePointValuesIndexReader() throws Exception {
+ Directory directory = newDirectory();
+ IndexWriter writer = new IndexWriter(directory,
newIndexWriterConfig(new MockAnalyzer(random())));
+
+ Document d1 = new Document();
+ d1.add(new IntPoint("default", 10));
+ writer.addDocument(d1);
+
+ Document d2 = new Document();
+ d2.add(new IntPoint("default", 100));
+ writer.addDocument(d2);
+
+ Document d3 = new Document();
+ d3.add(new IntPoint("default", 1000));
+ writer.addDocument(d3);
+
+ writer.forceMerge(1);
+ writer.commit();
+ writer.close();
+
+ DirectoryReader directoryReader;
+ DirectoryReader exitableDirectoryReader;
+ IndexReader reader;
+ IndexSearcher searcher;
+
+ Query query = IntPoint.newRangeQuery("default", 10, 20);
+
+ // Set a fairly high timeout value (1 second) and expect the query to
complete in that time frame.
+ // Not checking the validity of the result, all we are bothered about
in this test is the timing out.
+ directoryReader = DirectoryReader.open(directory);
+ exitableDirectoryReader = new ExitableDirectoryReader(directoryReader,
inifiniteQueryTimeout());
+ reader = new TestReader(getOnlyLeafReader(exitableDirectoryReader));
+ searcher = new IndexSearcher(reader);
+ searcher.search(query, 10);
+ reader.close();
+
+ // Set a really low timeout value (1 millisecond) and expect an
Exception
--- End diff --
Totally, comments fixed in 45996c885d3e52edcc21d47e40db443895982af5.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]