public SolrInputDocument deepCopy() { SolrInputDocument clone = new SolrInputDocument(); Set<Entry<String,SolrInputField>> entries = _fields.entrySet(); for (Map.Entry<String,SolrInputField> fieldEntry : entries) { clone._fields.put(fieldEntry.getKey(), fieldEntry.getValue().deepCopy()); } if (_childDocuments != null) { clone._childDocuments = new ArrayList<>(_childDocuments.size()); for (SolrInputDocument child : _childDocuments) { clone._childDocuments.add(child.deepCopy()); } } return clone; }
public SolrInputDocument deepCopy() { SolrInputDocument clone = new SolrInputDocument(); Set<Entry<String,SolrInputField>> entries = _fields.entrySet(); for (Map.Entry<String,SolrInputField> fieldEntry : entries) { clone._fields.put(fieldEntry.getKey(), fieldEntry.getValue().deepCopy()); } clone._documentBoost = _documentBoost; if (_childDocuments != null) { clone._childDocuments = new ArrayList<>(_childDocuments.size()); for (SolrInputDocument child : _childDocuments) { clone._childDocuments.add(child.deepCopy()); } } return clone; }
/** * Create a document for the ontology class, and add it to the index. * * @param doc the reusable Solr input document * @param ontClass the ontology class that should be parsed * @param root the top root category for ontClass * @param termBatch the batch of newly-processed documents to commit later */ private void addDoc(@Nonnull final SolrInputDocument doc, @Nonnull final OntClass ontClass, @Nonnull final OntClass root, Collection<SolrInputDocument> termBatch) { parseSolrDocumentFromOntClass(doc, ontClass, root); parseSolrDocumentFromOntParentClasses(doc, ontClass); extendTerm(new SolrVocabularyInputTerm(doc, this)); termBatch.add(doc.deepCopy()); doc.clear(); }
public boolean add(SolrInputDocument e) { SolrInputDocument transformed = e.deepCopy(); if (transformed.hasChildDocuments()) { ChildRollupDocs childList = new ChildRollupDocs(); childList.addAll(transformed.getChildDocuments()); transformed.addField("_childDocuments_", childList); transformed.getChildDocuments().clear(); } return delegate.add(transformed); } }