Class DocMaker
java.lang.Object
org.apache.lucene.benchmark.byTask.feeds.DocMaker
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
SpatialDocMaker
Creates
Document
objects. Uses a ContentSource
to generate DocData
objects. Supports the following parameters:
- content.source - specifies the
ContentSource
class 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.body.offsets - specifies whether to add offsets into the postings index for the body field. It is useful for highlighting. (default false)
- 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.norms
is 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).
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Document state, supports reuse of field instances across documents (seereuseFields
parameter). -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected FieldType
static final String
protected Config
static final String
static final String
static final String
protected boolean
static final String
protected boolean
protected ContentSource
static final String
static final String
protected FieldType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes theDocMaker
.protected DocMaker.DocState
Creates aDocument
object ready for indexing.makeDocument
(int size) Same asmakeDocument()
, only this method creates a document of the given size input bysize
.void
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.
-
Field Details
-
BODY_FIELD
- See Also:
-
TITLE_FIELD
- See Also:
-
DATE_FIELD
- See Also:
-
DATE_MSEC_FIELD
- See Also:
-
TIME_SEC_FIELD
- See Also:
-
ID_FIELD
- See Also:
-
BYTES_FIELD
- See Also:
-
NAME_FIELD
- See Also:
-
config
-
valType
-
bodyValType
-
source
-
reuseFields
protected boolean reuseFields -
indexProperties
protected boolean indexProperties
-
-
Constructor Details
-
DocMaker
public DocMaker()
-
-
Method Details
-
getDocState
-
close
Closes theDocMaker
. The base implementation closes theContentSource
, and it can be overridden to do more work (but make sure to call super.close()).- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
makeDocument
Creates aDocument
object ready for indexing. This method uses theContentSource
to get the next document from the source, and creates aDocument
object from the returned fields. IfreuseFields
was set to true, it will reuseDocument
andField
instances.- Throws:
Exception
-
makeDocument
Same asmakeDocument()
, only this method creates a document of the given size input bysize
.- Throws:
Exception
-
resetInputs
Reset inputs so that the test run would behave, input wise, as if it just started.- Throws:
IOException
-
setConfig
Set the configuration parameters of this doc maker.
-