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 ...
随机推荐
- 第三课 操作系统开发之x86模拟环境搭建
前面我们讲解了主引导程序的加载过程,并且制作了虚拟软盘a.img,最终这个主引导程序也在机器中成功运行了,但是实际开发的时候,并不会如此简单,免不了调试过程,如果还像上一节中直接将软盘放到机器中去加载 ...
- PR5
修改字幕的两种方式
- ElasticSearch(八):springboot集成ElasticSearch集群并使用
1. 集群的搭建 见:ElasticSearch(七) 2. springboot配置集群 2.1 创建springboot项目,使用idea创建,不过多介绍(创建项目时候建议不要勾选elastics ...
- JS校验 if (! temp_var) {} //拦截 ''和 undefined
if (! aaa) {} //拦截 ' ' 和 undefined 和 0 不拦截null
- 【WebForm】知识笔记
一.ashx介绍以及ashx文件与aspx文件之间的区别 ashx是什么文件? .ashx 文件用于写web handler的. .ashx文件与.aspx文件类似,可以通过它来调用HttpHandl ...
- BZOJ2460,LG4570 [BJWC2011]元素
题意 相传,在远古时期,位于西方大陆的 Magic Land 上,人们已经掌握了用魔法矿石炼制法杖的技术.那时人们就认识到,一个法杖的法力取决于使用的矿石. 一般地,矿石越多则法力越强,但物极必反:有 ...
- 推荐 Laravel API 项目必须使用的 8 个扩展包
如今在现代网络开发中,比较流行的模式是基于 API 开发,可以通过手机或网站来创建服务. Laravel 是创建基于 API 的项目的最佳框架之一,它为世界各地的大型社区提供了高速开发. Larave ...
- SQL Server系统表介绍与使用
关于SQL Server数据库的一切信息都保存在它的系统表格里.我怀疑你是否花过比较多的时间来检查系统表格,因为你总是忙于用户表格.但是,你可能需要偶尔做一点不同寻常的事,例如数据库所有的触发器.你可 ...
- FastAdmin 插件刷新缓存出现 200 红色提示框解决 always_populate_raw_post_data
使用 phpStudy 全新安装了 FastAdmin,PHP 版本是 5.6. 安装完成后在刷新插件缓存时出现红色 提示消息,但状态 为 200. 打开 F12 看,发现有以下信息. <br ...
- 自定义django的admin后台action
django的admin后台管理系统中自带了一个批量删除所选对象的action. 我们还可以添加自定义的action来实现其它类似的功能,如批量修改某个字段的功能.简单的,例如将文章批量标记为已发布的 ...