Class SearchTravRetVectorHighlightTask
- java.lang.Object
-
- org.apache.lucene.benchmark.byTask.tasks.PerfTask
-
- org.apache.lucene.benchmark.byTask.tasks.ReadTask
-
- org.apache.lucene.benchmark.byTask.tasks.SearchTravTask
-
- org.apache.lucene.benchmark.byTask.tasks.SearchTravRetVectorHighlightTask
-
- All Implemented Interfaces:
Cloneable
public class SearchTravRetVectorHighlightTask extends SearchTravTask
Search and Traverse and Retrieve docs task. Highlight the fields in the retrieved documents by using FastVectorHighlighter.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;...]
- traversal size - The number of hits to traverse, otherwise all will be traversed
- highlight - The number of the hits to highlight. Will always be less than or equal to traversal size. Default is Integer.MAX_VALUE (i.e. hits.length())
- maxFrags - The maximum number of fragments to score by the highlighter
- fragSize - The length of fragments
- fields - The fields to highlight. If not specified all fields will be highlighted (or at least attempted)
"SearchVecHlgtSameRdr" SearchTravRetVectorHighlight(size[10],highlight[10],maxFrags[3],fields[body]) > : 1000
Fields must be stored and term vector offsets and positions in order must be true for this task to work.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
Fields Modifier and Type Field Description protected int
fragSize
protected org.apache.lucene.search.vectorhighlight.FastVectorHighlighter
highlighter
protected int
maxFrags
protected int
numToHighlight
protected Set<String>
paramFields
-
Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.SearchTravTask
traversalSize
-
-
Constructor Summary
Constructors Constructor Description SearchTravRetVectorHighlightTask(PerfRunData runData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BenchmarkHighlighter
getBenchmarkHighlighter(org.apache.lucene.search.Query q)
Return an appropriate highlighter to be used with highlighting tasksprotected Collection<String>
getFieldsToHighlight(org.apache.lucene.document.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
-
-
-
-
Constructor Detail
-
SearchTravRetVectorHighlightTask
public SearchTravRetVectorHighlightTask(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 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.
-
withRetrieve
public boolean withRetrieve()
Description copied from class:ReadTask
Return true if, with search & results traversing, docs should be retrieved.- Overrides:
withRetrieve
in classSearchTravTask
-
numToHighlight
public int numToHighlight()
Description copied from class:ReadTask
Set to the number of documents to highlight.- Overrides:
numToHighlight
in classReadTask
- Returns:
- The number of the results to highlight. O means no docs will be highlighted.
-
getBenchmarkHighlighter
protected BenchmarkHighlighter getBenchmarkHighlighter(org.apache.lucene.search.Query q)
Description copied from class:ReadTask
Return an appropriate highlighter to be used with highlighting tasks- Overrides:
getBenchmarkHighlighter
in classReadTask
-
getFieldsToHighlight
protected Collection<String> getFieldsToHighlight(org.apache.lucene.document.Document document)
Description copied from class:ReadTask
Define the fields to highlight. Base implementation returns all fields- Overrides:
getFieldsToHighlight
in classReadTask
- 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 classSearchTravTask
-
-