FileDocCategorySizeDatePackage
SearchTravRetLoadFieldSelectorTask.javaAPI DocApache Lucene 2.2.02445Sat Jun 16 22:20:58 BST 2007org.apache.lucene.benchmark.byTask.tasks

SearchTravRetLoadFieldSelectorTask

public class SearchTravRetLoadFieldSelectorTask extends SearchTravTask
Search and Traverse and Retrieve docs task using a SetBasedFieldSelector.

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: comma separated list of Fields to load.

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

Fields Summary
protected FieldSelector
fieldSelector
Constructors Summary
public SearchTravRetLoadFieldSelectorTask(org.apache.lucene.benchmark.byTask.PerfRunData runData)

    super(runData);
    
  
Methods Summary
protected intretrieveDoc(org.apache.lucene.index.IndexReader ir, int id)

    return (ir.document(id, fieldSelector) == null ? 0 : 1);
  
public voidsetParams(java.lang.String params)

    this.params = params; // cannot just call super.setParams(), b/c it's params differ.
    Set fieldsToLoad = new HashSet();
    for (StringTokenizer tokenizer = new StringTokenizer(params, ","); tokenizer.hasMoreTokens();) {
      String s = tokenizer.nextToken();
      fieldsToLoad.add(s);
    }
    fieldSelector = new SetBasedFieldSelector(fieldsToLoad, Collections.EMPTY_SET);
  
public booleansupportsParams()

    return true;
  
public booleanwithRetrieve()

    return true;