Example usage for org.apache.solr.common SolrDocument hasChildDocuments

List of usage examples for org.apache.solr.common SolrDocument hasChildDocuments

Introduction

In this page you can find the example usage for org.apache.solr.common SolrDocument hasChildDocuments.

Prototype

@Override
    public boolean hasChildDocuments() 

Source Link

Usage

From source file:org.apache.metron.solr.dao.SolrUtilities.java

License:Apache License

protected static void insertChildAlerts(SolrDocument solrDocument, Map<String, Object> document) {
    // Make sure to put child alerts in
    if (solrDocument.hasChildDocuments()
            && solrDocument.getFieldValue(Constants.SENSOR_TYPE).equals(MetaAlertConstants.METAALERT_TYPE)) {
        List<Map<String, Object>> childDocuments = new ArrayList<>();
        for (SolrDocument childDoc : solrDocument.getChildDocuments()) {
            Map<String, Object> childDocMap = new HashMap<>();
            childDoc.getFieldNames().stream().filter(name -> !name.equals(SolrDao.VERSION_FIELD))
                    .forEach(name -> childDocMap.put(name, childDoc.getFieldValue(name)));
            childDocuments.add(childDocMap);
        }/*from ww w  . j  av a 2  s. c  o m*/

        document.put(MetaAlertConstants.ALERT_FIELD, childDocuments);
    }
}