solr

SOLR: how to copy data to another field with filtered values?

丶灬走出姿态 提交于 2020-04-17 21:53:34
问题 I have Price field in solr with below types of values. "Price":"0.07 AUD" "Price":"10.00" "Price":"AUD" So, I need another custom field CustomPrice To create this I used copy field to copy data from Price to CustomPrice But, I need only number values into CustomPrice like below "CustomPrice":"0.07" "CustomPrice":"10.00" "CustomPrice":"0" Also need CustomPrice field type as pfloat so we can sort the field by number. I tried CopyField , PatternTokenizerFactory , PatternReplaceFilterFactory to

Is there a SolrJ query builder?

◇◆丶佛笑我妖孽 提交于 2020-04-10 02:53:41
问题 Using solr 5.2.0 was wondering is there a query builder API/Jar/Ckient similar to Elasticsearch query builder API or do we have to bassically do String Kungfu to build queries in Solr? 回答1: Unfortunately, in SolrJ there is no such thing as a Builder for the query that goes into the q -Parameter. BUT: As Solr already operates on Lucene, we can as well use the Lucene QueryBuilder. The resulting Query objects (e.g. PhraseQuery) have a toString() method that provides you with the query string you

solr查询参数

半城伤御伤魂 提交于 2020-04-08 08:28:10
部分摘自: http://blog.csdn.net/u010342038/article/details/52997388 界面: 参数说明: 注意,以下是对所有的查询解析器都通用的参数。 defType :选择用来处理查询的查询分析器。 q (query)查询的关键字,此参数最为重要,例如,q=id:1,默认为q=*:*, fq (filter query)过虑查询,提供一个可选的筛选器查询。返回在q查询符合结果中同时符合的fq条件的查询结果,例如:q=id:1&fq=sort:[1 TO 5],找关键字id为1 的,并且sort是1到5之间的。 sort 排序方式,例如id desc 表示按照 "id" 降序 start 返结果的第几条记录开始,一般分页用,默认0开始 rows 指定返回结果最多有多少条记录,默认值为 10,配合start实现分页 fl (field list) 指定返回哪些字段,用逗号或空格分隔,注意:字段区分大小写,例如,fl= id,title,sort 回 df (default field) 默认的查询字段,一般默认指定。 wt (writer type)指定输出格式,有 xml, json, php等 indent 返回的结果是否缩进,默认关闭,用 indent=true|on 开启,一般调试json,php,phps

solr curl索引 CSV/Json/xml文件

老子叫甜甜 提交于 2020-04-08 08:27:06
  在windows系统中,用curl命令工具索引文件命令:   启动solr   在solr-6.6.0\bin的同级目录下的文件夹ImportData下要索引的文件.   1、索引 json文件     curl "http://localhost:8983/solr/mycore/update?commit=true" --data-binary @../ImportData/books.json -H "Content-type:application/json"        2、索引 csv文件     curl "http://localhost:8983/solr/mycore/update?commit=true" --data-binary @../ImportData/2017-07-07_info.csv -H "Content-type:application/csv"        3、索引 xml文件     curl "http://localhost:8983/solr/mycore/update?commit=true" --data-binary @../ImportData/hd.xml -H "Content-type:application/xml"        用curl貌似不能索引pdf文件     curl "http:/

solr 通过URL删除索引

こ雲淡風輕ζ 提交于 2020-04-08 06:50:21
使用:update 参数:stream.body=<delete><query>date:[2014-06-15T00:00:00Z TO *]</query></delete>&stream.contentType=text/xml;charset=utf-8&commit=true 直接用 url, 如: http://localhost:8080/solr/MyCollection/update?stream.body=<delete><query>date:[2014-06-15T00:00:00Z TO *]</query></delete>&stream.contentType=text/xml;charset=utf-8&commit=true 删除2014-06-15之后的索引数据 stream 相关参数还有: stream.file=(服务器本地文件), stream.url 分别指到你的删除文本, 这里是直接字符串内容用 stream.body 参数。 commit 参数是指提交,提交了才能看到删除效果。 删除指令有两种,一是:用 <id></id> 包装;二是:<query></query> 包装。 指令都很明显,一个是 id 值(是在 schema.xml 的 uniqueKey 所指字段的值,而不是索引内部的 docId);query 值是查询串,如

使用 Solr 创建 Core 并导入数据库数据

放肆的年华 提交于 2020-04-07 15:15:22
1. 输入 http://localhost:8080/solr/index.html 来到 Solr 的管理界面; 2. 点击左侧 Core Admin --> Add Core,然后输入自己想要的名字即可,输入完成点击 Add Core,如下图: 如果出现以下这种错误: Error CREATEing SolrCore 'log_core': Unable to create core [log_core] Caused by: Can't find resource 'solrconfig.xml' in classpath or 'E:\jd\workspace-solr\solr\log_core', 则说明没找到需要的配置文件; 修改步骤如下:   (1)找到 Solr 目录( 注意不是 Tomcat 下的 Solr,也不是工作空间的 Solr ):E:\jd\solr-6.6.2\server\solr\configsets\sample_techproducts_configs\conf,然后复制 conf 这个目录到工作空间的 Solr 中的 log_core(刚才创建的 Core 目录名) 目录下(我的地址:E:\jd\workspace-solr\solr\log_core);   (2)然后重新点击 Add Core 就会发现创建 Core 成功; 3.

solr常用命令

随声附和 提交于 2020-04-07 15:14:11
参考: https://www.cnblogs.com/studyhs/p/5181808.html     https://www.jianshu.com/p/cbb938c62e0e   1、用solr管理界面删除某个core的所有数据:     <delete><query>*:*</query></delete>     <commit/>        2、查询管理界面参数             q :查询字符串(必须的) *:* 表示查询所有;category:广告营销 表示按关键字“广告营销" 查询       fq : filter query 过滤查询。使用Filter Query可以充分利用Filter Query Cache,提高检索性能。作用:在q查询符合结果中同时是fq查询符合的(类似求交集),例如:fileType:pdf 表示查询所有文件类型是pdf的记录      sort : 排序。格式如下:字段名 排序方式;如fileDate desc 表示按fileDate 字段降序排列查询结果。         start: 表示查回结果从第几条数据开始显示      rows: 共显示多少条      fl: 指定查询结果返回哪些字段。多个时以逗号“,”分隔。不指定时,默认全返回。 id,summary,text,category,fileType   

Solr Mongo/DocDB Delta Import Query is not working

怎甘沉沦 提交于 2020-04-07 08:22:53
问题 I am trying to import data from Document DB to solr-5.4.1. Full import is executing properly but delta import is not working. When I execute delta import nothing happens Here is the current delta configuration deltaQuery="{'lastUpdatedDate':{$exists:true},'lastUpdatedDate':{$gt: Date('${dih.last_index_time}')}}" deltaImportQuery="{'_id':'${dih.delta._id}'}"> whole db-data-config.xml <dataConfig> <propertyWriter dateFormat="yyyy-MM-dd'T'HH:mm:ss.SSSXXX" type="SimplePropertiesWriter" filename=

CDH使用Solr实现HBase二级索引

五迷三道 提交于 2020-04-06 13:12:22
一、为什么要使用Solr做二级索引 二、实时查询方案 三、部署流程 3.1 安装HBase、Solr 3.2 增加HBase复制功能 3.3创建相应的 SolrCloud 集合 3.4 创建 Lily HBase Indexer 配置 3.5创建 Morphline 配置文件 3.6 注册 Lily HBase Indexer Configuration 和 Lily HBase Indexer Service 3.7 同步数据 3.8批量同步索引 3.9 设置多个indexer 四、数据的增删改查 4.1 增加 4.2更新 4.3删除 4.4 总结 五、 扩展命令 六、F&Q 6.1创建indexer失败,原来indexer已经存在 6.2创建indexer失败 6.3使用自带的indexer工具批量同步索引失败,提示找不到morphlines.conf 6.4使用自带的indexer工具批量同步索引失败,提示找不到solrconfig.xml 6.5使用自带的indexer工具批量同步索引失败,提示找不到Java heap space 6.6 HBaseIndexer启动后一会儿就自动退出 6.7 HBaseIndexer同步的数据与Solr不一致 6.8 出现了6.7的问题之后,修改了read-row="never"后,丢失部分字段 一、为什么要使用Solr做二级索引

Solr与HBase架构设计

Deadly 提交于 2020-04-06 13:12:02
大数据架构-使用HBase和Solr将存储与索引放在不同的机器上 摘要: HBase可以通过协处理器 Coprocessor 的方式向Solr发出请求,Solr对于接收到的数据可以做相关的同步:增、删、改索引的操作,这样就可以同时使用HBase存储量大和Solr检索性能高的优点了,更何况HBase和Solr都可以集群。这对海量数据存储、检索提供了一种方式,将存储与索引放在不同的机器上,是大数据 架构的必须品。 关键词: HBase, Solr, Coprocessor , 大数据 , 架构 正如我的之前的博客“ Solr与HBase架构设计 ” http://http://www.cnblogs.com/wgp13x/p/a8bb8ccd469c96917652201007ad3c50.html ​中所述,HBase和Solr可以通过协处理器 Coprocessor 的方式向Solr发出请求,Solr对于接收到的数据可以做相关的同步:增、删、改索引的操作。将存储与索引放在不同的机器上,这 是大数据架构的必须品,但目前还有很多不懂得此道的同学,他们对于这种思想感到很新奇,不过,这绝对是好的方向,所以不懂得抓紧学习吧。 有个朋友给我的那篇博客留言,说CDH也可以做这样的事情,我还没有试过,他还问我要与此相关的代码,于是我就稍微整理了一下,作为本篇文章的主要内容。关于CDH的事