首页 > 其他 > 详细

通过Solrj实现对索引库中数据的局部更新操作

时间:2017-02-26 18:51:44      阅读:338      评论:0      收藏:0      [点我收藏+]
    for (UpdateIndexDTO updateIndexDTO : data) {
                
                // 局部更新
                SolrInputDocument doc = new SolrInputDocument();
                bibGid = updateIndexDTO.getBibGid();
                doc.addField("gid", bibGid);
                String bookSummary = updateIndexDTO.getBookSummary();
                String bookContents = updateIndexDTO.getBookContents();
//                System.out.println(bookContents.getBytes().length);
                Map<String, String> bookSummaryMap = new HashMap<String, String>();
                Map<String, String> bookContentsMap = new HashMap<String, String>();
                bookSummaryMap.put("set", bookSummary);
                bookContentsMap.put("set", bookContents);
                
                doc.addField("bookSummary", bookSummaryMap);
                doc.addField("bookContents", bookContentsMap);
                
                docs.add(doc);
            }
            
            try {
                if(docs.size()>0){
                UpdateResponse updateResponse = solrServer.add(docs);
                System.out.println("updateResponse=" + updateResponse);
                }

百度云盘链接:http://pan.baidu.com/s/1nvDIeXN

通过Solrj实现对索引库中数据的局部更新操作

原文:http://www.cnblogs.com/xufan/p/6445180.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!