Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.benchmark.byTask.tasks
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

    public abstract class ReadTask

extends PerfTask

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.

Other side effects: none.

Field Summary

Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
`NEW_LINE, params`

Constructor Summary
`ReadTask(PerfRunData runData)`

Method Summary
`protected int` | `doHighlight(TokenStream ts, String text, Highlighter highlighter, boolean mergeContiguous, int maxFragments)`
`int` | `doLogic()` Perform the task once (ignoring repetions specification) Return number of work items done by this task.
`protected Collection` | `getFieldsToHighlight(Document document)` Define the fields to highlight.
`protected Highlighter` | `getHighlighter(Query q)`
`abstract QueryMaker` | `getQueryMaker()` Return query maker used for this task.
`protected Sort` | `getSort()`
`boolean` | `isMergeContiguousFragments()`
`int` | `maxNumFragments()`
`int` | `numToHighlight()` Set to the number of documents to highlight.
`protected Document` | `retrieveDoc(IndexReader ir, int id)`
`int` | `traversalSize()` Specify the number of hits to traverse.
`abstract boolean` | `withRetrieve()` Return true if, with search & results traversing, docs should be retrieved.
`abstract boolean` | `withSearch()` Return true if search should be performed.
`abstract boolean` | `withTraverse()` Return true if, with search, results should be traversed.
`abstract boolean` | `withWarm()` Return true if warming should be performed.

Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
`clone, getDepth, getName, getParams, getRunData, isDisableCounting, runAndMaybeStats, setDepth, setDisableCounting, setName, setParams, setup, shouldNeverLogAtStart, shouldNotRecordStats, supportsParams, tearDown, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ReadTask

    public ReadTask(PerfRunData runData)

Method Detail

### doLogic

    public int doLogic()
                throws Exception

  Description copied from class: `PerfTask`
  Perform the task once (ignoring repetions 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.

  Specified by:
    `doLogic` in class `PerfTask`
  Returns:
    number of work items done by this task.
  Throws:
    `Exception`

### retrieveDoc

    protected Document retrieveDoc(IndexReader ir,
                                   int id)
                            throws IOException

  Throws:
    `IOException`

### getQueryMaker

    public abstract QueryMaker getQueryMaker()

  Return query maker used for this task.

### withSearch

    public abstract boolean withSearch()

  Return true if search should be performed.

### 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.

### 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 when `withTraverse()` is true. Must be greater than 0.

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

  Returns:
    Integer.MAX_VALUE

### withRetrieve

    public abstract boolean withRetrieve()

  Return true if, with search & results traversing, docs should be retrieved.

### numToHighlight

    public int numToHighlight()

  Set to the number of documents to highlight.

  Returns:
    The number of the results to highlight. O means no docs will be highlighted.

### getHighlighter

    protected Highlighter getHighlighter(Query q)

### maxNumFragments

    public int maxNumFragments()

  Returns:
    the maxiumum number of highlighter fragments

### isMergeContiguousFragments

    public boolean isMergeContiguousFragments()

  Returns:
    true if the highlighter should merge contiguous fragments

### doHighlight

    protected int doHighlight(TokenStream ts,
                              String text,
                              Highlighter highlighter,
                              boolean mergeContiguous,
                              int maxFragments)
                       throws IOException

  Throws:
    `IOException`

### getSort

    protected Sort getSort()

### getFieldsToHighlight

    protected Collection getFieldsToHighlight(Document document)

  Define the fields to highlight. Base implementation returns all fields

  Parameters:
    `document` - The Document
  Returns:
    A Collection of Field names (Strings)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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