簡體   English   中英

Solr:如何創建新文檔

[英]Solr : How to create new document

好吧,我正在編寫一個自定義請求處理程序,並想創建solr文檔。 我有幾個字段及其值,我想使用這些字段創建一個新文檔,並將其放入doclist中,然后將doclist(或SolrDocumentList)填充到響應對象中以發送回客戶端。

我該怎么做 ??

謝謝

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

 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.

就是這樣

創建SolrInputDocument的實例,然后使用addField()方法將的所有字段值添加到文檔中。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM