Package com.lucidworks.apollo.component
Class PipelineDocumentUtils
java.lang.Object
com.lucidworks.apollo.component.PipelineDocumentUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.solr.common.SolrInputDocumentconvertPipelineDocumentToSolr(com.lucidworks.apollo.common.pipeline.PipelineDocument doc) static com.lucidworks.apollo.common.pipeline.PipelineDocumentconvertSolrInputDocumentToPipelineDocument(org.apache.solr.common.SolrInputDocument solrDoc) static com.lucidworks.apollo.common.pipeline.PipelineDocumentflatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc) Flatten the structure of document.static com.lucidworks.apollo.common.pipeline.PipelineDocumentflatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, boolean handleListsIndexNumbered) Flatten the structure of document.static com.lucidworks.apollo.common.pipeline.PipelineDocumentfromEventMap(Map<CharSequence, Object> map) static com.lucidworks.apollo.common.pipeline.PipelineDocumentstatic com.lucidworks.apollo.common.pipeline.PipelineDocumentstatic com.lucidworks.apollo.common.pipeline.PipelineDocumentfromMap(Map<?, ?> map, com.lucidworks.apollo.common.pipeline.PipelineDocument template, boolean handleListsIndexNumbered) static com.lucidworks.apollo.common.pipeline.PipelineDocumentfromSolrDocument(org.apache.solr.common.SolrDocument sd) static com.lucidworks.apollo.common.pipeline.UpdateModifiergetUpdateModifier(String fieldName, com.lucidworks.apollo.common.pipeline.PipelineDocument doc) static booleanisCommandsDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument pipelineDocument) Return true if the given pipeline document is a special "Commands" document.static booleanisDataModelDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument document) Checks if the givenPipelineDocumentis a data model document, i.e.static com.lucidworks.apollo.common.pipeline.PipelineDocumentmapToPipelineDocument(Map<String, Object> entry) static InputStreamobjectToInputStream(Object input) static voidprefixPipelineDocumentFields(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, String prefix) put the prefix infront of every field within the pipeline doctoMap(com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
-
Field Details
-
INDEX_ANNOTATIONS
- See Also:
-
LW_DATA_MODEL_TYPE_S
- See Also:
-
UNSAFE_PATTERN
-
-
Constructor Details
-
PipelineDocumentUtils
public PipelineDocumentUtils()
-
-
Method Details
-
prefixPipelineDocumentFields
public static void prefixPipelineDocumentFields(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, String prefix) put the prefix infront of every field within the pipeline doc- Parameters:
doc-prefix-
-
fromSolrDocument
public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromSolrDocument(org.apache.solr.common.SolrDocument sd) -
toMap
-
fromEventMap
public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromEventMap(Map<CharSequence, Object> map) -
fromMap
-
fromMap
public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromMap(Map<?, ?> map, boolean handleListsIndexNumbered) -
fromMap
public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromMap(Map<?, ?> map, com.lucidworks.apollo.common.pipeline.PipelineDocument template, boolean handleListsIndexNumbered) -
flatten
public static com.lucidworks.apollo.common.pipeline.PipelineDocument flatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc) Flatten the structure of document. Flatten lists into a multivalued field. Seeflatten(PipelineDocument, boolean)for more info -
flatten
public static com.lucidworks.apollo.common.pipeline.PipelineDocument flatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, boolean handleListsIndexNumbered) Flatten the structure of document. For each field in the document it checks the value of the field and converts it (recursively) to multiple fields under the following conditions:- field is an array or collection: if all values are flat then they will be
added as multiple fields with the same name.
Otherwise, if
handleListsIndexNumberedis true then an index (starting from 0) will be appended to the field name, and values will be further flattened recursively. - field is a map: keys will be appended to the field name, and values will be further flattened recursively.
- Parameters:
doc- input document, possibly containing nested datahandleListsIndexNumbered- is a flag to flatten lists into index numbered fields- Returns:
- new instance of flattened document, or the original document if it was already flattened.
- field is an array or collection: if all values are flat then they will be
added as multiple fields with the same name.
Otherwise, if
-
convertSolrInputDocumentToPipelineDocument
public static com.lucidworks.apollo.common.pipeline.PipelineDocument convertSolrInputDocumentToPipelineDocument(org.apache.solr.common.SolrInputDocument solrDoc) -
convertPipelineDocumentToSolr
public static org.apache.solr.common.SolrInputDocument convertPipelineDocumentToSolr(com.lucidworks.apollo.common.pipeline.PipelineDocument doc) -
getUpdateModifier
public static com.lucidworks.apollo.common.pipeline.UpdateModifier getUpdateModifier(String fieldName, com.lucidworks.apollo.common.pipeline.PipelineDocument doc) -
isCommandsDocument
public static boolean isCommandsDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument pipelineDocument) Return true if the given pipeline document is a special "Commands" document. The latter is defined as a document that contains no fields but does contain command(s).- Parameters:
pipelineDocument- Document to check.- Returns:
- True if document is considered a "Commands" document, otherwise false.
-
objectToInputStream
-
mapToPipelineDocument
-
isDataModelDocument
public static boolean isDataModelDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument document) Checks if the givenPipelineDocumentis a data model document, i.e. it has been tagged as containing fields associated with a Fusion data model.- Parameters:
document- aPipelineDocument- Returns:
- true if the given
PipelineDocumentis a data model document
-