0

Well I am writing a custom request handler and want to create solr document. I have few fields and their values, I want to create a new document with these field and put in doclist and then stuffing doclist(or SolrDocumentList) in response object to send back to client.

how can I do it ??

thanks

2 Answers 2

0

Well May be I got the answer.

 Step 1: Create object of SolrDocumentList 
 Step 2: Create document and add field by calling "add" method
 Step 3: call "add" method using object of SolrDocumentList to add solrDocument because SolrDocumentList  class extends ArrayList<SolrDocument> class.

and thats it

0

Create an instance of SolrInputDocument and add all the field values of the to the document using addField() method.

SolrInputDocument doc = new SolrInputDocument();
doc.addField("fieldName", fieldValue);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.