FileDocCategorySizeDatePackage
DeleteDocTask.javaAPI DocApache Lucene 2.1.02649Wed Feb 14 10:46:14 GMT 2007org.apache.lucene.benchmark.byTask.tasks

DeleteDocTask

public class DeleteDocTask extends PerfTask
Delete a document by docid. Other side effects: none.

Fields Summary
private static int
logStep
private static int
deleteStep
private static int
numDeleted
private static int
lastDeleted
private int
docid
private boolean
byStep
Constructors Summary
public DeleteDocTask(org.apache.lucene.benchmark.byTask.PerfRunData runData)

    super(runData);
  
Methods Summary
public intdoLogic()

  
       
    getRunData().getIndexReader().deleteDocument(docid);
    lastDeleted = docid;
    return 1; // one work item done here
  
private voidlog(int count)

    if (logStep>0 && (count%logStep)==0) {
      System.out.println("--> processed "+count+" docs, last deleted: "+lastDeleted);
    }
  
public voidsetParams(java.lang.String params)
Set the params (docid only)

param
params docid to delete, or -1 for deleting by delete gap settings.

    super.setParams(params);
    docid = (int) Float.parseFloat(params);
    byStep = (docid < 0);
  
public voidsetup()

    super.setup();
    // one time static initializations
    if (logStep<0) {
      logStep = getRunData().getConfig().get("doc.delete.log.step",500);
    }
    if (deleteStep<0) {
      deleteStep = getRunData().getConfig().get("doc.delete.step",8);
    }
    // set the docid to be deleted
    docid = (byStep ? lastDeleted + deleteStep : docid);
  
public voidtearDown()

    log(++numDeleted);
    super.tearDown();