@Override public void addChildDocuments(Collection<SolrDocument> children) { for (SolrDocument child : children) { addChildDocument(child); } }
public void addChildDocuments(Collection<SolrDocument> childs) { for (SolrDocument child : childs) { addChildDocument(child); } }
doc.addChildDocument(readDocument(parser));
doc.addChildDocument(readDocument(parser)); int event = parser.next(); if (event == XMLStreamConstants.END_ELEMENT) { //Doc ends
public SolrDocument readSolrDocument(DataInputInputStream dis) throws IOException { tagByte = dis.readByte(); int size = readSize(dis); SolrDocument doc = new SolrDocument(new LinkedHashMap<>(size)); for (int i = 0; i < size; i++) { String fieldName; Object obj = readVal(dis); // could be a field name, or a child document if (obj instanceof SolrDocument) { doc.addChildDocument((SolrDocument)obj); continue; } else { fieldName = (String)obj; } Object fieldVal = readVal(dis); doc.setField(fieldName, fieldVal); } return doc; }
public SolrDocument readSolrDocument(DataInputInputStream dis) throws IOException { tagByte = dis.readByte(); int size = readSize(dis); SolrDocument doc = new SolrDocument(); for (int i = 0; i < size; i++) { String fieldName; Object obj = readVal(dis); // could be a field name, or a child document if (obj instanceof SolrDocument) { doc.addChildDocument((SolrDocument)obj); continue; } else { fieldName = (String)obj; } Object fieldVal = readVal(dis); doc.setField(fieldName, fieldVal); } return doc; }
/** * @param d SolrInputDocument to convert * @return a SolrDocument with the same fields and values as the SolrInputDocument */ public static SolrDocument toSolrDocument(SolrInputDocument d) { SolrDocument doc = new SolrDocument(); for (SolrInputField field : d) { doc.setField(field.getName(), field.getValue()); } if (d.getChildDocuments() != null) { for (SolrInputDocument in : d.getChildDocuments()) { doc.addChildDocument(toSolrDocument(in)); } } return doc; }