solr的multivalued使用说明
solr的schema.xml配置文件在配置Filed的时候,有个属性:
MutiValued:true if this field may containmutiple values per documents,这个说明有点模糊,下面结合实际应用,列举两个不同的例子。
例子一:一个field有多个值,值来自同一filed
- <fields>
- <!-- general -->
- <field name="id" type="int" indexed="true" stored="true" multiValued="false" required="true"/>
- <field name="planTime" type="tdate" indexed="true" stored="false" multiValued="false" />
- <field name="state" type="string" indexed="true" stored="false" multiValued="false" />
- <field name="overDate" type="string" indexed="true" stored="false" multiValued="false" />
- <field name="type" type="int" indexed="true" stored="false" multiValued="false" />
- <field name="contactName" type="textComplex" indexed="true" stored="false" multiValued="false" />
- <field name="contactTel" type="string" indexed="true" stored="false" multiValued="false" />
- <field name="customer" type="textComplex" indexed="true" stored="false" multiValued="false" />
- <field name="alias" type="textComplex" indexed="true" stored="false" multiValued="false" />
- <field name="englishName" type="textComplex" indexed="true" stored="false" multiValued="false" />
- <field name="executor" type="int" indexed="true" stored="true" multiValued="true" />
- <!--[1m~K[1m~][1m~W段-->
- <field name="keywords" type="text" indexed="true" stored="false" multiValued="true"/>
- </fields>
其中:
- <field name="executor" type="int" indexed="true" stored="true" multiValued="true" /
最后看下查询效果:

从上图看书,executor这个field可以多个值,任何executor:29 OR executor:40,类似查询都能查出id为3的记录。
附注:使用solrj建此索引时,定义成集合类型即可,如:
- @Field
- private Set<Integer> executor;
- public Set<Integer> getExecutor() {
- return executor;
- }
- public void setExecutor(Set<Integer> executor) {
- this.executor = executor;
- }
例子二:类似综合搜索,结合copyFiled使用,多个Filed拷贝到该Field上

从上图看出keywords区域,是name、introduction、industryName三个的集合,无论搜索name、introduction、industryName中任意一个,都能通过keywords搜索出来。
solr的multivalued使用说明的更多相关文章
- solr 从零学习开始
2010-10 目 录 1 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4. ...
- Solr使用入门指南
本文转自http://chuanliang2007.spaces.live.com/blog/cns!E5B7AB2851A4C9D2!499.entry?wa=wsignin1.0 由于搜索引擎功能 ...
- 企业级搜索引擎Solr使用入门指南
由于搜索引擎功能在门户社区中对提高用户体验有着重在门户社区中涉及大量需要搜索引擎的功能需求,目前在实现搜索引擎的方案上有集中方案可供选择: 基于Lucene自己进行封装实现站内搜索. 工作量及扩展性都 ...
- Solr入门指南
本文转自http://chuanliang2007.spaces.live.com/blog/cns!E5B7AB2851A4C9D2!499.entry?wa=wsignin1.0 因为搜索引擎功能 ...
- [转载] Solr使用入门指南
转载自http://blog.csdn.net/liuzhenwen/article/details/4060922 由于搜索引擎功能在门户社区中对提高用户体验有着重要的作用,在门户社区中涉及大量需要 ...
- Solr部分更新MultiValued的Date日期字段时报错及解决方案
问题描述如标题. 异常信息如下: Result Caused by: org.apache.solr.common.SolrException: Invalid Date String:'Mon Se ...
- Importing multi-valued field into Solr from mySQL using Solr Data Import Handler
http://stackoverflow.com/questions/20233837/importing-multi-valued-field-into-solr-from-mysql-using- ...
- solr联合多个字段进行检索(multivalued和copyfield的使用)
在实际工作中不仅仅对索引中的单个字段进行搜索.需要进行综合查询. 比如book表中有id,name(标题),price,summary(摘要),content(内容),我们要找一本书的时候,查询关键字 ...
- Solr部分更新MultiValued的Date日期字段时报错及解决方案:Invalid Date String:'Mon Sep 14 01:48:38 CST 2015'
问题描述如标题. 异常信息如下: Result Caused by: org.apache.solr.common.SolrException: Invalid Date String:'Mon Se ...
随机推荐
- Redis 缓存服务器
Redis 服务器 Remote Dictionay Server Redis是一个key-value持久化产品,通常被称为数据结构服务器. Redis的key是string类型:value可以是 ...
- 微信小程序插件使用
使用插件 小程序开发者可便捷地把插件添加到自己的小程序内,丰富小程序的服务.当用户在使用小程序时,将可以在小程序内使用插件提供的服务. 开放范围 所有小程序 接入流程 在小程序管理后台添加插件 小程序 ...
- 【其他】msb-lsb-intel-motorola大小端问题
MSB(Most Significant Bit) 最高有效位: LSB(Least Significant Bit) 最低有效位 intel格式:低字节在前 Motorola格式:高字节在前 参考1 ...
- opencv-python教程学习系列3-视频操作
前言 opencv-python教程学习系列记录学习python-opencv过程的点滴,本文主要介绍视频的获取和保存,坚持学习,共同进步. 系列教程参照OpenCV-Python中文教程: 系统环境 ...
- BZOJ3473: 字符串【后缀数组+思维】
Description 给定n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中至少k个字符串的子串? Input 第一行两个整数n,k. 接下来n行每行一个字符串. Output 一 ...
- 将基于 .NET Framework 的 WPF 项目迁移到基于 .NET Core 3
在 Connect(); 2018 大会上,微软发布了 .NET Core 3 Preview,以及基于 .NET Core 3 的 WPF:同时还发布了 Visual Studio 2019 预览版 ...
- 杭电 KazaQ's Socks
KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered from 1 to n in his cl ...
- 2018-2019-2 《网络对抗技术》Kali安装 Week1 20165212
2018-2019-2 <网络对抗技术>Kali安装 Week1 20165212 1.完成安装linux kali和vm tools 装的第三遍成功安装.前面两次镜像文件不行,没驱动(网 ...
- hasura graphql-engine v1.0.0-alpha25 的几个方便功能
hasura graphql-engine 是一个很不错的graphql 引擎,但是我们的数据模型经常可能会有变动, 但是以前的版本对于这些的处理,官方的方式是删除元数据,重启server,都不是很好 ...
- 理解JAVA虚拟机(下)
2016-04-18 20:40:59 三.JVM内存参数调整及监控 3.1 JVM之内存调整 JVM运行时数据区的内存大小可以通过参数来设置,通常能设置的两块区域为堆空间和持久代(方法区),设置方 ...