solr的使用
来源:互联网 发布:黑暗之魂3男号捏脸数据 编辑:程序博客网 时间:2024/06/12 01:26
solr实现索引的增加,删除,更新操作
@Test public void addDocumentTest() throws Exception{ //创建一个SOlrServer对象(抽象类),使用其实现类HttpSolrServer //指定solr服务的地址 String url = "http://192.168.254.128:8080/solr/collection1"; SolrServer solrServer = new HttpSolrServer(url); //创建一个文档对象SolrInputDucument SolrInputDocument document = new SolrInputDocument(); //添加字段 document.addField("id", "121"); document.addField("item_title", "电脑"); document.addField("item_price", 1000); //把文档对象写入索引库 solrServer.add(document); //提交 solrServer.commit(); } @Test public void deleteById() throws Exception { String url = "http://192.168.254.128:8080/solr/collection1"; SolrServer solrServer = new HttpSolrServer(url); solrServer.deleteById("test01"); solrServer.commit(); } @Test public void deleteByQuery() throws Exception { String url = "http://192.168.254.128:8080/solr/collection1"; SolrServer solrServer = new HttpSolrServer(url); solrServer.deleteByQuery("item_title:手机"); solrServer.commit(); }
阅读全文
1 0
- solr 的使用
- Solr solrj的使用
- solr的基本使用
- solr-solrj的使用
- Solr的使用
- solr的使用
- Solr的基本使用
- solr的使用
- solr的使用
- solr的基本使用
- Solr的基本使用
- Solr的安装使用
- Solr的基本使用
- Solr的基本使用
- solr的使用
- Solr使用:1.Solr的安装部署
- Solr使用:2.Solr核的创建
- solr的配置及使用
- HTMLReporter TestNG 配置
- django1.10.3=安装
- sql两种创建临时表 验证存在于删除
- CentOS设置服务开机启动的方法
- 排序算法 -- (二)希尔排序
- solr的使用
- 记录一次webpack2的项目架构
- HTTP协议的8种请求类型介绍
- TCP进阶基本功---tcp挥手状态
- 数据描述预备,几个概念
- js html dom
- TypeScript 类型推论整理
- 基于nodeJS的前端开发到底啥意思?
- 线程池的参数【转】