org.apache.lucene.benchmark.byTask.tasks

## Class SearchTravTask

- java.lang.Object
- - org.apache.lucene.benchmark.byTask.tasks.PerfTask
  - - org.apache.lucene.benchmark.byTask.tasks.ReadTask
    - - org.apache.lucene.benchmark.byTask.tasks.SearchTravTask

- All Implemented Interfaces:
    Cloneable
  Direct Known Subclasses:
    SearchTravRetHighlightTask, SearchTravRetLoadFieldSelectorTask, SearchTravRetTask

      public class SearchTravTask
      extends ReadTask

  Search and Traverse task.

  Note: This task reuses the reader if it is already open. Otherwise a reader is opened at start and closed at the end.

  Takes optional param: traversal size (otherwise all results are traversed).

  Other side effects: counts additional 1 (record) for each traversed hit.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `traversalSize`

    - ### Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask

      `logStep, NEW_LINE, params, stopNow`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchTravTask(PerfRunData runData)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `QueryMaker` | `getQueryMaker()` Return query maker used for this task.
    `void` | `setParams(String params)` Set the params of this task.
    `boolean` | `supportsParams()` Sub classes that support parameters must override this method to return true.
    `int` | `traversalSize()` Specify the number of hits to traverse.
    `boolean` | `withRetrieve()` Return true if, with search and results traversing, docs should be retrieved.
    `boolean` | `withSearch()` Return true if search should be performed.
    `boolean` | `withTraverse()` Return true if, with search, results should be traversed.
    `boolean` | `withWarm()` Return true if warming should be performed.

    - ### Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.ReadTask

      `createCollector, doLogic, getSort, numHits, retrieveDoc, setup, withCollector, withTopDocs, withTotalHits`

    - ### 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, setRunInBackground, shouldNeverLogAtStart, shouldNotRecordStats, stopNow, tearDown, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### traversalSize

          protected int traversalSize

  - ### Constructor Detail

    - #### SearchTravTask

          public SearchTravTask(PerfRunData runData)

  - ### Method Detail

    - #### withRetrieve

          public boolean withRetrieve()

      Description copied from class: `ReadTask`
      Return true if, with search and results traversing, docs should be retrieved.
      Specified by:
        `withRetrieve` in class `ReadTask`

    - #### withSearch

          public boolean withSearch()

      Description copied from class: `ReadTask`
      Return true if search should be performed.
      Specified by:
        `withSearch` in class `ReadTask`

    - #### withTraverse

          public boolean withTraverse()

      Description copied from class: `ReadTask`
      Return true if, with search, results should be traversed.
      Specified by:
        `withTraverse` in class `ReadTask`

    - #### withWarm

          public boolean withWarm()

      Description copied from class: `ReadTask`
      Return true if warming should be performed.
      Specified by:
        `withWarm` in class `ReadTask`

    - #### getQueryMaker

          public QueryMaker getQueryMaker()

      Description copied from class: `ReadTask`
      Return query maker used for this task.
      Specified by:
        `getQueryMaker` in class `ReadTask`

    - #### traversalSize

          public int traversalSize()

      Description copied from class: `ReadTask`
      Specify the number of hits to traverse. Tasks should override this if they want to restrict the number of hits that are traversed when `ReadTask.withTraverse()` is true. Must be greater than 0.

      Read task calculates the traversal as: Math.min(hits.length(), traversalSize())

      Overrides:
        `traversalSize` in class `ReadTask`
      Returns:
        Integer.MAX_VALUE

    - #### setParams

          public void setParams(String params)

      Description copied from class: `PerfTask`
      Set the params of this task.
      Overrides:
        `setParams` in class `PerfTask`

    - #### supportsParams

          public boolean supportsParams()

      Description copied from class: `PerfTask`
      Sub classes that support parameters must override this method to return true.
      Overrides:
        `supportsParams` in class `PerfTask`
      Returns:
        true iff this task supports command line params.

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.