Package org.apache.solr.update.processor
Class SolrInputDocumentReader
- java.lang.Object
- 
- java.io.Reader
- 
- org.apache.solr.update.processor.SolrInputDocumentReader
 
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Readable
 
 public class SolrInputDocumentReader extends Reader Reader on top of SolrInputDocument that can "stream" a document as a character stream in a memory efficient way, to avoid potentially large intermediate string buffers containing whole document content.- WARNING: This API is experimental and might change in incompatible ways in the next release.
 
- 
- 
Constructor SummaryConstructors Constructor Description SolrInputDocumentReader(org.apache.solr.common.SolrInputDocument doc, int maxTotalChars, int maxCharsPerFieldValue)Creates a character-stream reader that streams all String fields in the document with space as separatorSolrInputDocumentReader(org.apache.solr.common.SolrInputDocument doc, String[] fields, int maxTotalChars, int maxCharsPerFieldValue, String fieldValueSep)Creates a character-stream reader that reads the listed fields in order, with max lengths as specified.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringasString(Reader reader)Gets the whole reader as a Stringvoidclose()protected static String[]getStringFields(org.apache.solr.common.SolrInputDocument doc)intread(char[] cbuf, int off, int len)booleanready()voidsetEodReturnValue(int eodReturnValue)Choose another return value than -1 for end of document reached.- 
Methods inherited from class java.io.Readermark, markSupported, nullReader, read, read, read, reset, skip, transferTo
 
- 
 
- 
- 
- 
Constructor Detail- 
SolrInputDocumentReaderpublic SolrInputDocumentReader(org.apache.solr.common.SolrInputDocument doc, int maxTotalChars, int maxCharsPerFieldValue)Creates a character-stream reader that streams all String fields in the document with space as separator- Parameters:
- doc- Solr input document
- maxCharsPerFieldValue- max chars to consume per field value
- maxTotalChars- max chars to consume total
 
 - 
SolrInputDocumentReaderpublic SolrInputDocumentReader(org.apache.solr.common.SolrInputDocument doc, String[] fields, int maxTotalChars, int maxCharsPerFieldValue, String fieldValueSep)Creates a character-stream reader that reads the listed fields in order, with max lengths as specified.- Parameters:
- doc- Solr input document
- fields- list of field names to include
- fieldValueSep- separator to insert between field values
- maxCharsPerFieldValue- max chars to consume per field value
- maxTotalChars- max chars to consume total
 
 
- 
 - 
Method Detail- 
readpublic int read(char[] cbuf, int off, int len) throws IOException- Specified by:
- readin class- Reader
- Throws:
- IOException
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- Reader
- Throws:
- IOException
 
 - 
readypublic boolean ready() throws IOException- Overrides:
- readyin class- Reader
- Throws:
- IOException
 
 - 
setEodReturnValuepublic void setEodReturnValue(int eodReturnValue) Choose another return value than -1 for end of document reached. Warning: Only to work around buggy consumers such as LangDetect 1.1- Parameters:
- eodReturnValue- integer which defaults to -1
 
 - 
asStringpublic static String asString(Reader reader) Gets the whole reader as a String- Returns:
- string of concatenated fields
 
 - 
getStringFieldsprotected static String[] getStringFields(org.apache.solr.common.SolrInputDocument doc) 
 
- 
 
-