Class DocMaker
- java.lang.Object
-
- org.apache.lucene.benchmark.byTask.feeds.DocMaker
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class DocMaker extends Object implements Closeable
CreatesDocumentobjects. Uses aContentSourceto generateDocDataobjects. Supports the following parameters:- content.source - specifies the
ContentSourceclass to use (default SingleDocSource). - doc.stored - specifies whether fields should be stored (default false).
- doc.body.stored - specifies whether the body field should be stored (default = doc.stored).
- doc.tokenized - specifies whether fields should be tokenized (default true).
- doc.body.tokenized - specifies whether the body field should be tokenized (default = doc.tokenized).
- doc.tokenized.norms - specifies whether norms should be stored in the index or not. (default false).
- doc.body.tokenized.norms - specifies whether norms should be
stored in the index for the body field. This can be set to true, while
doc.tokenized.normsis set to false, to allow norms storing just for the body field. (default true). - doc.term.vector - specifies whether term vectors should be stored for fields (default false).
- doc.term.vector.positions - specifies whether term vectors should be stored with positions (default false).
- doc.term.vector.offsets - specifies whether term vectors should be stored with offsets (default false).
- doc.store.body.bytes - specifies whether to store the raw bytes of the document's content in the document (default false).
- doc.reuse.fields - specifies whether Field and Document objects should be reused (default true).
- doc.index.props - specifies whether the properties returned by
- doc.random.id.limit - if specified, docs will be assigned random
IDs from 0 to this limit. This is useful with UpdateDoc
for testing performance of IndexWriter.updateDocument.
DocData.getProps()will be indexed. (default false).
-
-
Field Summary
Fields Modifier and Type Field Description static StringBODY_FIELDprotected Field.IndexbodyIndexValprotected Field.StorebodyStoreValstatic StringBYTES_FIELDprotected Configconfigstatic StringDATE_FIELDstatic StringDATE_MSEC_FIELDstatic StringID_FIELDprotected booleanindexPropertiesprotected Field.IndexindexValstatic StringNAME_FIELDprotected booleanreuseFieldsprotected ContentSourcesourceprotected Field.StorestoreValprotected Field.TermVectortermVecValstatic StringTIME_SEC_FIELDstatic StringTITLE_FIELD
-
Constructor Summary
Constructors Constructor Description DocMaker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes theDocMaker.longgetBytesCount()Returns the number of bytes generated by the content source since last reset.protected org.apache.lucene.benchmark.byTask.feeds.DocMaker.DocStategetDocState()longgetTotalBytesCount()Returns the total number of bytes that were generated by the content source defined to that doc maker.DocumentmakeDocument()Creates aDocumentobject ready for indexing.DocumentmakeDocument(int size)Same asmakeDocument(), only this method creates a document of the given size input bysize.voidresetInputs()Reset inputs so that the test run would behave, input wise, as if it just started.voidsetConfig(Config config)Set the configuration parameters of this doc maker.
-
-
-
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
-
storeVal
protected Field.Store storeVal
-
bodyStoreVal
protected Field.Store bodyStoreVal
-
indexVal
protected Field.Index indexVal
-
bodyIndexVal
protected Field.Index bodyIndexVal
-
termVecVal
protected Field.TermVector termVecVal
-
source
protected ContentSource source
-
reuseFields
protected boolean reuseFields
-
indexProperties
protected boolean indexProperties
-
-
Method Detail
-
getDocState
protected org.apache.lucene.benchmark.byTask.feeds.DocMaker.DocState getDocState()
-
close
public void close() throws IOExceptionCloses theDocMaker. The base implementation closes theContentSource, and it can be overridden to do more work (but make sure to call super.close()).- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getBytesCount
public long getBytesCount()
Returns the number of bytes generated by the content source since last reset.
-
getTotalBytesCount
public long getTotalBytesCount()
Returns the total number of bytes that were generated by the content source defined to that doc maker.
-
makeDocument
public Document makeDocument() throws Exception
Creates aDocumentobject ready for indexing. This method uses theContentSourceto get the next document from the source, and creates aDocumentobject from the returned fields. IfreuseFieldswas set to true, it will reuseDocumentandFieldinstances.- Throws:
Exception
-
makeDocument
public Document makeDocument(int size) throws Exception
Same asmakeDocument(), only this method creates a document of the given size input bysize.- Throws:
Exception
-
resetInputs
public void resetInputs() throws IOExceptionReset inputs so that the test run would behave, input wise, as if it just started.- Throws:
IOException
-
setConfig
public void setConfig(Config config)
Set the configuration parameters of this doc maker.
-
-