org.apache.lucene.benchmark.byTask.feeds
Class DocMaker

java.lang.Object
  extended by org.apache.lucene.benchmark.byTask.feeds.DocMaker
All Implemented Interfaces:
Closeable

public class DocMaker
extends Object
implements Closeable

Creates Document objects. Uses a ContentSource to generate DocData objects. Supports the following parameters:


Nested Class Summary
protected static class DocMaker.DocState
          Document state, supports reuse of field instances across documents (see reuseFields parameter).
 
Field Summary
static String BODY_FIELD
           
protected  FieldType bodyValType
           
static String BYTES_FIELD
           
protected  Config config
           
static String DATE_FIELD
           
static String DATE_MSEC_FIELD
           
static String ID_FIELD
           
protected  boolean indexProperties
           
static String NAME_FIELD
           
protected  boolean reuseFields
           
protected  ContentSource source
           
static String TIME_SEC_FIELD
           
static String TITLE_FIELD
           
protected  FieldType valType
           
 
Constructor Summary
DocMaker()
           
 
Method Summary
 void close()
          Closes the DocMaker.
protected  DocMaker.DocState getDocState()
           
 Document makeDocument()
          Creates a Document object ready for indexing.
 Document makeDocument(int size)
          Same as makeDocument(), only this method creates a document of the given size input by size.
 void resetInputs()
          Reset inputs so that the test run would behave, input wise, as if it just started.
 void setConfig(Config config, ContentSource source)
          Set the configuration parameters of this doc maker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BODY_FIELD

public static final String BODY_FIELD
See Also:
Constant Field Values

TITLE_FIELD

public static final String TITLE_FIELD
See Also:
Constant Field Values

DATE_FIELD

public static final String DATE_FIELD
See Also:
Constant Field Values

DATE_MSEC_FIELD

public static final String DATE_MSEC_FIELD
See Also:
Constant Field Values

TIME_SEC_FIELD

public static final String TIME_SEC_FIELD
See Also:
Constant Field Values

ID_FIELD

public static final String ID_FIELD
See Also:
Constant Field Values

BYTES_FIELD

public static final String BYTES_FIELD
See Also:
Constant Field Values

NAME_FIELD

public static final String NAME_FIELD
See Also:
Constant Field Values

config

protected Config config

valType

protected FieldType valType

bodyValType

protected FieldType bodyValType

source

protected ContentSource source

reuseFields

protected boolean reuseFields

indexProperties

protected boolean indexProperties
Constructor Detail

DocMaker

public DocMaker()
Method Detail

getDocState

protected DocMaker.DocState getDocState()

close

public void close()
           throws IOException
Closes the DocMaker. The base implementation closes the ContentSource, and it can be overridden to do more work (but make sure to call super.close()).

Specified by:
close in interface Closeable
Throws:
IOException

makeDocument

public Document makeDocument()
                      throws Exception
Creates a Document object ready for indexing. This method uses the ContentSource to get the next document from the source, and creates a Document object from the returned fields. If reuseFields was set to true, it will reuse Document and Field instances.

Throws:
Exception

makeDocument

public Document makeDocument(int size)
                      throws Exception
Same as makeDocument(), only this method creates a document of the given size input by size.

Throws:
Exception

resetInputs

public void resetInputs()
                 throws IOException
Reset inputs so that the test run would behave, input wise, as if it just started.

Throws:
IOException

setConfig

public void setConfig(Config config,
                      ContentSource source)
Set the configuration parameters of this doc maker.



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