org.apache.lucene.benchmark.byTask.tasks
Class SearchTravRetHighlightTask

java.lang.Object
  extended by org.apache.lucene.benchmark.byTask.tasks.PerfTask
      extended by org.apache.lucene.benchmark.byTask.tasks.ReadTask
          extended by org.apache.lucene.benchmark.byTask.tasks.SearchTravTask
              extended by org.apache.lucene.benchmark.byTask.tasks.SearchTravRetHighlightTask
All Implemented Interfaces:
Cloneable

public class SearchTravRetHighlightTask
extends SearchTravTask

Search and Traverse and Retrieve docs task. Highlight the fields in the retrieved documents. Uses the SimpleHTMLFormatter for formatting.

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 multivalued, comma separated param string as: size[<traversal size>],highlight[<int>],maxFrags[<int>],mergeContiguous[<boolean>],fields[name1;name2;...]

Example:
"SearchHlgtSameRdr" SearchTravRetHighlight(size[10],highlight[10],mergeContiguous[true],maxFrags[3],fields[body]) > : 1000
 
Documents must be stored in order for this task to work. Additionally, term vector positions can be used as well.

Other side effects: counts additional 1 (record) for each traversed hit, and 1 more for each retrieved (non null) document and 1 for each fragment returned.


Field Summary
protected  Highlighter highlighter
           
protected  int maxDocCharsToAnalyze
           
protected  int maxFrags
           
protected  boolean mergeContiguous
           
protected  int numToHighlight
           
protected  Set<String> paramFields
           
 
Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.SearchTravTask
traversalSize
 
Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
logStep, NEW_LINE, params, stopNow
 
Constructor Summary
SearchTravRetHighlightTask(PerfRunData runData)
           
 
Method Summary
protected  BenchmarkHighlighter getBenchmarkHighlighter(Query q)
          Return an appropriate highlighter to be used with highlighting tasks
protected  Collection<String> getFieldsToHighlight(Document document)
          Define the fields to highlight.
 int numToHighlight()
          Set to the number of documents to highlight.
 void setParams(String params)
          Set the params of this task.
 void setup()
          Task setup work that should not be measured for that specific task.
 boolean withRetrieve()
          Return true if, with search & results traversing, docs should be retrieved.
 
Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.SearchTravTask
getQueryMaker, supportsParams, traversalSize, withSearch, withTraverse, withWarm
 
Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.ReadTask
createCollector, doLogic, getSort, numHits, retrieveDoc, withCollector, withMaxScore, withScore
 
Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
clone, close, getBackgroundDeltaPriority, getDepth, getLogMessage, getName, getParams, getRunData, getRunInBackground, isDisableCounting, runAndMaybeStats, 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

numToHighlight

protected int numToHighlight

mergeContiguous

protected boolean mergeContiguous

maxFrags

protected int maxFrags

paramFields

protected Set<String> paramFields

highlighter

protected Highlighter highlighter

maxDocCharsToAnalyze

protected int maxDocCharsToAnalyze
Constructor Detail

SearchTravRetHighlightTask

public SearchTravRetHighlightTask(PerfRunData runData)
Method Detail

setup

public void setup()
           throws Exception
Description copied from class: PerfTask
Task setup work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work from doLogic() to this method. Only the work done in doLogicis 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.

Overrides:
setup in class ReadTask
Throws:
Exception

withRetrieve

public boolean withRetrieve()
Description copied from class: ReadTask
Return true if, with search & results traversing, docs should be retrieved.

Overrides:
withRetrieve in class SearchTravTask

numToHighlight

public int numToHighlight()
Description copied from class: ReadTask
Set to the number of documents to highlight.

Overrides:
numToHighlight in class ReadTask
Returns:
The number of the results to highlight. O means no docs will be highlighted.

getBenchmarkHighlighter

protected BenchmarkHighlighter getBenchmarkHighlighter(Query q)
Description copied from class: ReadTask
Return an appropriate highlighter to be used with highlighting tasks

Overrides:
getBenchmarkHighlighter in class ReadTask

getFieldsToHighlight

protected Collection<String> getFieldsToHighlight(Document document)
Description copied from class: ReadTask
Define the fields to highlight. Base implementation returns all fields

Overrides:
getFieldsToHighlight in class ReadTask
Parameters:
document - The Document
Returns:
A Collection of Field names (Strings)

setParams

public void setParams(String params)
Description copied from class: PerfTask
Set the params of this task.

Overrides:
setParams in class SearchTravTask


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