Class CallerSpecificQueryLimit

java.lang.Object
org.apache.solr.search.CallerSpecificQueryLimit
All Implemented Interfaces:
org.apache.lucene.index.QueryTimeout, org.apache.solr.search.QueryLimit

public class CallerSpecificQueryLimit extends Object implements org.apache.solr.search.QueryLimit
Helper class to simulate query timeouts at specific points in various components that call QueryLimits.shouldExit(). These calling points are identified by the calling class' simple name and optionally a method name and the optional maximum count, e.g. MoreLikeThisComponent or ClusteringComponent.finishStage, ClusteringComponent.finishStage:100.

NOTE: implementation details cause the expression simpleName to be disabled when also any simpleName.anyMethod[:NNN] expression is used for the same class name.

NOTE 2: when maximum count is a negative number e.g. simpleName.someMethod:-1 then only the number of calls to QueryLimits.shouldExit() for that expression will be reported but no limit will be enforced.

  • Constructor Details

    • CallerSpecificQueryLimit

      public CallerSpecificQueryLimit(String... callerExprs)
      Signal a timeout in places that match the calling classes (and methods).
      Parameters:
      callerExprs - list of expressions in the format of simpleClassName[.methodName][:NNN]. If the list is empty or null then the first call to shouldExit() from any caller will match.
    • CallerSpecificQueryLimit

      public CallerSpecificQueryLimit(Collection<String> callerExprs)
  • Method Details

    • getTrippedBy

      public Set<String> getTrippedBy()
      Returns the set of caller expressions that were tripped.
    • getCallCounts

      public Map<String,Integer> getCallCounts()
      Returns a map of tripped caller expressions to their current call counts.
    • shouldExit

      public boolean shouldExit()
      Specified by:
      shouldExit in interface org.apache.lucene.index.QueryTimeout
    • currentValue

      public Object currentValue()
      Specified by:
      currentValue in interface org.apache.solr.search.QueryLimit