mirror of https://github.com/apache/lucene.git
SOLR-7876: exit ExitableDirectoryReader wrapper if timeout is not enabled
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c2484192de
commit
330907bf11
|
@ -27,6 +27,10 @@ New Features
|
|||
length computations, to avoid skew from documents that don't have the field.
|
||||
(Ahmet Arslan via Robert Muir)
|
||||
|
||||
* SOLR-7876: The QueryTimeout interface now has a isTimeoutEnabled method
|
||||
that can return false to exit from ExitableDirectoryReader wrapping at
|
||||
the point fields() is called. (yonik)
|
||||
|
||||
API Changes
|
||||
|
||||
* LUCENE-3312: The API of oal.document was restructured to
|
||||
|
|
|
@ -80,7 +80,13 @@ public class ExitableDirectoryReader extends FilterDirectoryReader {
|
|||
|
||||
@Override
|
||||
public Fields fields() throws IOException {
|
||||
return new ExitableFields(super.fields(), queryTimeout);
|
||||
Fields fields = super.fields();
|
||||
if (queryTimeout.isTimeoutEnabled()) {
|
||||
return new ExitableFields(fields, queryTimeout);
|
||||
}
|
||||
else {
|
||||
return fields; // break out of wrapper as soon as possible
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,5 +29,10 @@ public interface QueryTimeout {
|
|||
*/
|
||||
public abstract boolean shouldExit();
|
||||
|
||||
/** Returns true if timeouts are enabled for this query (i.e. if shouldExit would ever return true) */
|
||||
public default boolean isTimeoutEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,11 @@ New Features
|
|||
|
||||
* SOLR-7707: Add StreamExpression Support to RollupStream (Dennis Gove, Joel Bernstein)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
* SOLR-7876: Speed up queries and operations that use many terms when timeAllowed has not been
|
||||
specified. Speedups of up to 8% were observed. (yonik)
|
||||
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -49,6 +49,11 @@ public class SolrQueryTimeoutImpl implements QueryTimeout {
|
|||
return timeoutAt.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTimeoutEnabled() {
|
||||
return get() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue