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

4

2 回答 2

0

创建 SolrInputDocument 的实例,并使用 addField() 方法将 的所有字段值添加到文档中。

SolrInputDocument doc = new SolrInputDocument();
doc.addField("fieldName", fieldValue);
于 2014-11-05T13:05:27.633 回答
0

好吧,也许我得到了答案。

 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.

就是这样

于 2013-05-14T04:57:25.920 回答