Package org.apache.lucene.tests.index
Class DocHelper
- java.lang.Object
-
- org.apache.lucene.tests.index.DocHelper
-
public class DocHelper extends Object
Helper functions for tests that handles documents
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DocHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Document
createDocument(int n, String indexName, int numFields)
static int
numFields(Document doc)
static void
setupDoc(Document doc)
Adds the fields above to a documentstatic SegmentCommitInfo
writeDoc(Random random, Directory dir, Analyzer analyzer, Similarity similarity, Document doc)
Writes the document to the directory using the analyzer and the similarity score; returns the SegmentInfo describing the new segmentstatic SegmentCommitInfo
writeDoc(Random random, Directory dir, Document doc)
Writes the document to the directory using a segment named "test"; returns the SegmentInfo describing the new segment
-
-
-
Field Detail
-
customType
public static final FieldType customType
-
FIELD_1_TEXT
public static final String FIELD_1_TEXT
- See Also:
- Constant Field Values
-
TEXT_FIELD_1_KEY
public static final String TEXT_FIELD_1_KEY
- See Also:
- Constant Field Values
-
textField1
public static Field textField1
-
TEXT_TYPE_STORED_WITH_TVS
public static final FieldType TEXT_TYPE_STORED_WITH_TVS
-
FIELD_2_TEXT
public static final String FIELD_2_TEXT
- See Also:
- Constant Field Values
-
FIELD_2_FREQS
public static final int[] FIELD_2_FREQS
-
TEXT_FIELD_2_KEY
public static final String TEXT_FIELD_2_KEY
- See Also:
- Constant Field Values
-
textField2
public static Field textField2
-
customType3
public static final FieldType customType3
-
FIELD_3_TEXT
public static final String FIELD_3_TEXT
- See Also:
- Constant Field Values
-
TEXT_FIELD_3_KEY
public static final String TEXT_FIELD_3_KEY
- See Also:
- Constant Field Values
-
textField3
public static Field textField3
-
KEYWORD_TEXT
public static final String KEYWORD_TEXT
- See Also:
- Constant Field Values
-
KEYWORD_FIELD_KEY
public static final String KEYWORD_FIELD_KEY
- See Also:
- Constant Field Values
-
keyField
public static Field keyField
-
customType5
public static final FieldType customType5
-
NO_NORMS_TEXT
public static final String NO_NORMS_TEXT
- See Also:
- Constant Field Values
-
NO_NORMS_KEY
public static final String NO_NORMS_KEY
- See Also:
- Constant Field Values
-
noNormsField
public static Field noNormsField
-
customType6
public static final FieldType customType6
-
NO_TF_TEXT
public static final String NO_TF_TEXT
- See Also:
- Constant Field Values
-
NO_TF_KEY
public static final String NO_TF_KEY
- See Also:
- Constant Field Values
-
noTFField
public static Field noTFField
-
customType7
public static final FieldType customType7
-
UNINDEXED_FIELD_TEXT
public static final String UNINDEXED_FIELD_TEXT
- See Also:
- Constant Field Values
-
UNINDEXED_FIELD_KEY
public static final String UNINDEXED_FIELD_KEY
- See Also:
- Constant Field Values
-
unIndField
public static Field unIndField
-
STRING_TYPE_STORED_WITH_TVS
public static final FieldType STRING_TYPE_STORED_WITH_TVS
-
UNSTORED_1_FIELD_TEXT
public static final String UNSTORED_1_FIELD_TEXT
- See Also:
- Constant Field Values
-
UNSTORED_FIELD_1_KEY
public static final String UNSTORED_FIELD_1_KEY
- See Also:
- Constant Field Values
-
unStoredField1
public static Field unStoredField1
-
customType8
public static final FieldType customType8
-
UNSTORED_2_FIELD_TEXT
public static final String UNSTORED_2_FIELD_TEXT
- See Also:
- Constant Field Values
-
UNSTORED_FIELD_2_KEY
public static final String UNSTORED_FIELD_2_KEY
- See Also:
- Constant Field Values
-
unStoredField2
public static Field unStoredField2
-
LAZY_FIELD_BINARY_KEY
public static final String LAZY_FIELD_BINARY_KEY
- See Also:
- Constant Field Values
-
LAZY_FIELD_BINARY_BYTES
public static byte[] LAZY_FIELD_BINARY_BYTES
-
lazyFieldBinary
public static Field lazyFieldBinary
-
LAZY_FIELD_KEY
public static final String LAZY_FIELD_KEY
- See Also:
- Constant Field Values
-
LAZY_FIELD_TEXT
public static final String LAZY_FIELD_TEXT
- See Also:
- Constant Field Values
-
lazyField
public static Field lazyField
-
LARGE_LAZY_FIELD_KEY
public static final String LARGE_LAZY_FIELD_KEY
- See Also:
- Constant Field Values
-
LARGE_LAZY_FIELD_TEXT
public static String LARGE_LAZY_FIELD_TEXT
-
largeLazyField
public static Field largeLazyField
-
FIELD_UTF1_TEXT
public static final String FIELD_UTF1_TEXT
- See Also:
- Constant Field Values
-
TEXT_FIELD_UTF1_KEY
public static final String TEXT_FIELD_UTF1_KEY
- See Also:
- Constant Field Values
-
textUtfField1
public static Field textUtfField1
-
FIELD_UTF2_TEXT
public static final String FIELD_UTF2_TEXT
- See Also:
- Constant Field Values
-
FIELD_UTF2_FREQS
public static final int[] FIELD_UTF2_FREQS
-
TEXT_FIELD_UTF2_KEY
public static final String TEXT_FIELD_UTF2_KEY
- See Also:
- Constant Field Values
-
textUtfField2
public static Field textUtfField2
-
fields
public static Field[] fields
-
all
public static Map<String,IndexableField> all
-
indexed
public static Map<String,IndexableField> indexed
-
stored
public static Map<String,IndexableField> stored
-
unstored
public static Map<String,IndexableField> unstored
-
unindexed
public static Map<String,IndexableField> unindexed
-
termvector
public static Map<String,IndexableField> termvector
-
notermvector
public static Map<String,IndexableField> notermvector
-
lazy
public static Map<String,IndexableField> lazy
-
noNorms
public static Map<String,IndexableField> noNorms
-
noTf
public static Map<String,IndexableField> noTf
-
-
Method Detail
-
setupDoc
public static void setupDoc(Document doc)
Adds the fields above to a document- Parameters:
doc
- The document to write
-
writeDoc
public static SegmentCommitInfo writeDoc(Random random, Directory dir, Document doc) throws IOException
Writes the document to the directory using a segment named "test"; returns the SegmentInfo describing the new segment- Throws:
IOException
-
writeDoc
public static SegmentCommitInfo writeDoc(Random random, Directory dir, Analyzer analyzer, Similarity similarity, Document doc) throws IOException
Writes the document to the directory using the analyzer and the similarity score; returns the SegmentInfo describing the new segment- Throws:
IOException
-
numFields
public static int numFields(Document doc)
-
-