Exception rising while using QueryTimeout
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
```
import org.apache.lucene.facet.DrillDownQuery;
import org.apache.lucene.facet.DrillSideways;
import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.QueryTimeoutImpl;
import org.apache.lucene.search.CollectorManager;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.TopFieldCollector;
import org.apache.lucene.search.TopFieldDocs;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.store.SimpleFSLockFactory;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Path;
public class BugTest {
@Test
public void test() throws IOException {
TaxonomyReader taxonomyReader = new DirectoryTaxonomyReader(new NIOFSDirectory(Path.of(
"src/test/resources/fs-base/root/search/test/221031_130517/categories"), SimpleFSLockFactory.INSTANCE));
FacetsConfig facetsConfig = new FacetsConfig();
final DrillDownQuery facetedQuery = new DrillDownQuery(facetsConfig);
facetedQuery.add("dataclass", "STD"); // if we add dim
IndexReader indexReader = DirectoryReader.open(new NIOFSDirectory(Path.of(
"src/test/resources/fs-base/root/search/test/221031_130517/main")));
IndexSearcher indexSearcher = new IndexSearcher(indexReader);
indexSearcher.setTimeout(new QueryTimeoutImpl(1000000)); // and timeout
DrillSideways drillSideways = new DrillSideways(indexSearcher, facetsConfig, taxonomyReader);
final CollectorManager collectorManager =
TopFieldCollector.createSharedManager(Sort.RELEVANCE, 100, null, Integer.MAX_VALUE);
final DrillSideways.ConcurrentDrillSidewaysResult r = drillSideways.search(facetedQuery, collectorManager);
// exception is thrown
}
}
```
```
java.lang.IllegalArgumentException: maxDoc must be Integer.MAX_VALUE
at org.apache.lucene.facet.DrillSidewaysScorer.score(DrillSidewaysScorer.java:84)
at org.apache.lucene.search.TimeLimitingBulkScorer.score(TimeLimitingBulkScorer.java:68)
at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:38)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:744)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:662)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:656)
at org.apache.lucene.facet.DrillSideways.searchSequentially(DrillSideways.java:510)
at org.apache.lucene.facet.DrillSideways.search(DrillSideways.java:446)
```
I don't know why there is that restriction. Maybe it is possible just delete
### Version and environment details
Lucene 9.4.2
Contributor guide
Research direction
Reproduce the exception with the provided BugTest and Lucene 9.4.2 setup. Start with org.apache.lucene.facet.DrillSidewaysScorer.java at line 84, then inspect TimeLimitingBulkScorer.java:68 and DrillSideways.java; done means the QueryTimeout path no longer throws the reported maxDoc exception and coverage verifies the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100