Class PipelineDocumentUtils

java.lang.Object
com.lucidworks.apollo.component.PipelineDocumentUtils

public class PipelineDocumentUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final Pattern
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.solr.common.SolrInputDocument
    convertPipelineDocumentToSolr(com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    convertSolrInputDocumentToPipelineDocument(org.apache.solr.common.SolrInputDocument solrDoc)
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    flatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
    Flatten the structure of document.
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    flatten(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, boolean handleListsIndexNumbered)
    Flatten the structure of document.
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    fromMap(Map<?,?> map)
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    fromMap(Map<?,?> map, boolean handleListsIndexNumbered)
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    fromMap(Map<?,?> map, com.lucidworks.apollo.common.pipeline.PipelineDocument template, boolean handleListsIndexNumbered)
     
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
    fromSolrDocument(org.apache.solr.common.SolrDocument sd)
     
    static com.lucidworks.apollo.common.pipeline.UpdateModifier
    getUpdateModifier(String fieldName, com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
     
    static boolean
    isCommandsDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument pipelineDocument)
    Return true if the given pipeline document is a special "Commands" document.
    static boolean
    isDataModelDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument document)
    Checks if the given PipelineDocument is a data model document, i.e.
    static com.lucidworks.apollo.common.pipeline.PipelineDocument
     
     
    static void
    prefixPipelineDocumentFields(com.lucidworks.apollo.common.pipeline.PipelineDocument doc, String prefix)
    put the prefix infront of every field within the pipeline doc
    static Map<String,Object>
    toMap(com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public static Map<String,Object> toMap(com.lucidworks.apollo.common.pipeline.PipelineDocument doc)
    • fromEventMap

      public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromEventMap(Map<CharSequence,Object> map)
    • fromMap

      public static com.lucidworks.apollo.common.pipeline.PipelineDocument fromMap(Map<?,?> map)
    • 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. See flatten(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 handleListsIndexNumbered is 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 data
      handleListsIndexNumbered - 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.
    • 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

      public static InputStream objectToInputStream(Object input)
    • mapToPipelineDocument

      public static com.lucidworks.apollo.common.pipeline.PipelineDocument mapToPipelineDocument(Map<String,Object> entry)
    • isDataModelDocument

      public static boolean isDataModelDocument(com.lucidworks.apollo.common.pipeline.PipelineDocument document)
      Checks if the given PipelineDocument is a data model document, i.e. it has been tagged as containing fields associated with a Fusion data model.
      Parameters:
      document - a PipelineDocument
      Returns:
      true if the given PipelineDocument is a data model document