Class CsvSplitterConfig
java.lang.Object
com.norconex.importer.handler.BaseLabelableConfig
com.norconex.importer.handler.BaseDocHandlerConfig
com.norconex.importer.handler.splitter.BaseDocumentSplitterConfig
com.norconex.importer.handler.splitter.impl.CsvSplitterConfig
- All Implemented Interfaces:
Labelable
Split files with Coma-Separated values (or any other characters, like tab) into one document per line.
Can be used both as a pre-parse (text documents) or post-parse handler documents.
Given this sample CSV file content...
'clientId','clientName','clientOrg','orgDesc' '123','Joe Dalton','ACME Inc.','Organization\'s description' '345','Avrel Dalton','Daisy Town','Another one'
... the above example will split the file into two documents (one for each row after the header row):
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charstatic final charstatic final char -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanOne or several columns containing the text to be considered as the document "content".charThe escape character.Matcher of one or more fields to use as the source of content to split into new documents, instead of the original document content.intThe number of lines to skip before starting to parse lines.charThe value's surrounding quotes character.The column containing the unique document reference.charThe value-separator character.inthashCode()booleanWhether to use the first row as field names for values.setContentColumns(List<String> contentColumns) One or several columns containing the text to be considered as the document "content".setEscapeCharacter(char escapeCharacter) The escape character.setFieldMatcher(TextMatcher fieldMatcher) setLinesToSkip(int linesToSkip) The number of lines to skip before starting to parse lines.setQuoteCharacter(char quoteCharacter) The value's surrounding quotes character.setReferenceColumn(String referenceColumn) The column containing the unique document reference.setSeparatorCharacter(char separatorCharacter) The value-separator character.setUseFirstRowAsFields(boolean useFirstRowAsFields) Whether to use the first row as field names for values.toString()Methods inherited from class com.norconex.importer.handler.splitter.BaseDocumentSplitterConfig
isDiscardOriginal, setDiscardOriginalMethods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Field Details
-
DEFAULT_SEPARATOR_CHARACTER
public static final char DEFAULT_SEPARATOR_CHARACTER- See Also:
-
DEFAULT_QUOTE_CHARACTER
public static final char DEFAULT_QUOTE_CHARACTER- See Also:
-
DEFAULT_ESCAPE_CHARACTER
public static final char DEFAULT_ESCAPE_CHARACTER- See Also:
-
-
Constructor Details
-
CsvSplitterConfig
public CsvSplitterConfig()
-
-
Method Details
-
setFieldMatcher
-
getContentColumns
One or several columns containing the text to be considered as the document "content".- Returns:
- content columns
-
setContentColumns
One or several columns containing the text to be considered as the document "content".- Parameters:
contentColumns- content columns- Returns:
- this instance
-
getFieldMatcher
Matcher of one or more fields to use as the source of content to split into new documents, instead of the original document content.- Returns:
- field matcher
-
getSeparatorCharacter
public char getSeparatorCharacter()The value-separator character. Default is the comma character (,).- Returns:
- value-separator character
-
getQuoteCharacter
public char getQuoteCharacter()The value's surrounding quotes character. Default is the double-quote character (").- Returns:
- value's surrounding quotes character
-
getEscapeCharacter
public char getEscapeCharacter()The escape character. Default is the backslash character (\).- Returns:
- escape character
-
isUseFirstRowAsFields
public boolean isUseFirstRowAsFields()Whether to use the first row as field names for values. Default isfalse.- Returns:
trueif using first row as field names.
-
getLinesToSkip
public int getLinesToSkip()The number of lines to skip before starting to parse lines. Default is0.- Returns:
- the number of lines to skip
-
getReferenceColumn
The column containing the unique document reference. Can be either a column name or position, starting at1.- Returns:
- column name or position
-
setSeparatorCharacter
The value-separator character. Default is the comma character (,).- Parameters:
separatorCharacter- value-separator character- Returns:
this.
-
setQuoteCharacter
The value's surrounding quotes character. Default is the double-quote character (").- Parameters:
quoteCharacter- value's surrounding quotes character- Returns:
this.
-
setEscapeCharacter
The escape character. Default is the backslash character (\).- Parameters:
escapeCharacter- escape character- Returns:
this.
-
setUseFirstRowAsFields
Whether to use the first row as field names for values. Default isfalse.- Parameters:
useFirstRowAsFields-trueif using first row as field names- Returns:
this.
-
setLinesToSkip
The number of lines to skip before starting to parse lines. Default is0.- Parameters:
linesToSkip- the number of lines to skip- Returns:
this.
-
setReferenceColumn
The column containing the unique document reference. Can be either a column name or position, starting at1.- Parameters:
referenceColumn- column name or position- Returns:
this.
-
equals
- Overrides:
equalsin classBaseDocumentSplitterConfig
-
canEqual
- Overrides:
canEqualin classBaseDocumentSplitterConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseDocumentSplitterConfig
-
toString
- Overrides:
toStringin classBaseDocumentSplitterConfig
-