Class ReadTask
java.lang.Object
org.apache.lucene.benchmark.byTask.tasks.PerfTask
org.apache.lucene.benchmark.byTask.tasks.ReadTask
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
SearchTask,SearchTravTask,SearchWithSortTask,WarmTask
Read index (abstract) task. Sub classes implement withSearch(), withWarm(), withTraverse() and
withRetrieve() methods to configure the actual action.
Note: All ReadTasks reuse the reader if it is already open. Otherwise a reader is opened at start and closed at the end.
The search.num.hits config parameter sets the top number of hits to collect
during searching. If print.hits.field is set, then each hit is printed along with
the value of that field.
Other side effects: none.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CollectorManager<?, ?> intdoLogic()Perform the task once (ignoring repetitions specification) Return number of work items done by this task.abstract QueryMakerReturn query maker used for this task.protected SortgetSort()intnumHits()Specify the number of hits to retrieve.protected DocumentretrieveDoc(StoredFields storedFields, int id) voidsetup()Task setup work that should not be measured for that specific task.intSpecify the number of hits to traverse.booleanabstract booleanReturn true if, with search and results traversing, docs should be retrieved.abstract booleanReturn true if search should be performed.protected intwithTopDocs(IndexSearcher searcher, Query q, TopDocs hits) booleanWhether totalHits should be computed (only useful with field sort)abstract booleanReturn true if, with search, results should be traversed.abstract booleanwithWarm()Return true if warming should be performed.Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
clone, close, getAlgLineNum, getBackgroundDeltaPriority, getDepth, getLogMessage, getName, getParams, getRunData, getRunInBackground, isDisableCounting, runAndMaybeStats, setAlgLineNum, setDepth, setDisableCounting, setName, setParams, setRunInBackground, shouldNeverLogAtStart, shouldNotRecordStats, stopNow, supportsParams, tearDown, toString
-
Constructor Details
-
ReadTask
-
-
Method Details
-
doLogic
Description copied from class:PerfTaskPerform the task once (ignoring repetitions specification) Return number of work items done by this task. For indexing that can be number of docs added. For warming that can be number of scanned items, etc. -
withTopDocs
- Throws:
Exception
-
createCollectorManager
- Throws:
Exception
-
retrieveDoc
- Throws:
IOException
-
getQueryMaker
Return query maker used for this task. -
withSearch
public abstract boolean withSearch()Return true if search should be performed. -
withCollector
public boolean withCollector() -
withWarm
public abstract boolean withWarm()Return true if warming should be performed. -
withTraverse
public abstract boolean withTraverse()Return true if, with search, results should be traversed. -
withTotalHits
public boolean withTotalHits()Whether totalHits should be computed (only useful with field sort) -
traversalSize
public int traversalSize()Specify the number of hits to traverse. Tasks should override this if they want to restrict the number of hits that are traversed whenwithTraverse()is true. Must be greater than 0.Read task calculates the traversal as: Math.min(hits.length(), traversalSize())
- Returns:
- Integer.MAX_VALUE
-
setup
Description copied from class:PerfTaskTask setup work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work fromPerfTask.doLogic()to this method. Only the work done inPerfTask.doLogic()is measured for this task. Notice that higher level (sequence) tasks containing this task would then measure larger time than the sum of their contained tasks. -
numHits
public int numHits()Specify the number of hits to retrieve. Tasks should override this if they want to restrict the number of hits that are collected during searching. Must be greater than 0.- Returns:
- 10 by default, or search.num.hits config if set.
-
withRetrieve
public abstract boolean withRetrieve()Return true if, with search and results traversing, docs should be retrieved. -
getSort
-