On 2/22/2016 1:55 AM, Clemens Wyss DEV wrote: > SolrClient solrClient = getSolrClient( coreName, true ); > Collection<SolrInputDocument> batch = new ArrayList<SolrInputDocument>(); > while ( elements.hasNext() ) > { > IIndexableElement elem = elements.next(); > SolrInputDocument doc = createSolrDocForElement( elem, provider, locale ); > // [1] > if ( doc != null ) > { > batch.add( doc ); > if ( batch.size() == 100 ) > { > solrClient.add( documents ); // [2] > batch = new ArrayList<SolrInputDocument>(); // [3] > } > } > } > if ( !batch.isEmpty() ) > { > addMultipleDocuments( uniqueProviderName, solrClient, batch ); > batch = null; > }
Did you type the above code as a paraphrase of the actual code, or is that a copy/paste of actual code? I'm guessing that it was typed or hand-edited to something more simple, not pasted as-is, because in the loop you have an add() call on the client, but outside the loop you have something entirely different -- a locally defined method called addMultipleDocuments. I would expect these calls to be identical. Your followup, where you pointed out an error in the add statement, suggests even more that you did not provide actual code. I understand the desire to protect your investment in your work, but partial information makes it difficult to offer help. You could send the code to me unicast if you think it's too proprietary for public eyes, but if you do that, I will keep the discussion on the list and only talk about the code in general terms. The mailing list will generally eat any attachments, other means are necessary to relay code. For efficiency reasons, you might try "batch.clear();" instead of creating a new ArrayList. It doesn't seem likely that this would actually fix the problem, but since the true code is probably different, I can't say for sure. Thanks, Shawn