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 ...
随机推荐
- AppStore 中的app怎么样生成二维码,来提供下载
首先在:iTunes里面找到 AppStore模块,然后搜索你的 App 在App 下载选项有 Copy Link ,拷贝地址 在二维码生成器里直接生成二维码就,OK 如果,想要多个和安卓做一个二维 ...
- spark 与 Hadoop 融合后启动 slf4j提示Class path contains multiple SLF4J bindings
相关参考文献: https://www.oschina.net/question/93435_174549 警告信息如下: 看起来明明就是一个文件,怎么还提示multiple bindings呢,sl ...
- Unity3D-常用小功能详解,例子(得分变动效果、倒计时)
Unity3D-Demo多个功能方法 本文提供全流程,中文翻译.Chinar坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) 1 Score Ind ...
- HDU 1084:What Is Your Grade?
Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in col ...
- 出于迁移项目的考虑,GitHub 中 Fork 出来的项目,如何与原项目断开 Fork 关系?
如果需要为 GitHub 上的项目做贡献,我们通常会 Fork 到自己的名称空间下.在推送代码之后添加 pull request 时,GitHub 会自动为我们跨仓库建立 pull request 的 ...
- The Alphabet Sticker
题目大意:给你一串字符串,其中有一部分未知,用'?'表示. 现在定义一种合法的Sticker,比如"aabcc","ccccab".即所有相同的字母要在一起才是 ...
- ACM中的取模
取模本身的性质:(之前有一篇博客写过)三则运算(+,-,*)过程中的取模与最后的取模一样(前提是最后不超long long(或int) 范围,所以为防止超范围,直接对三则运算中的过程取模) 然后就是A ...
- jdreact相关操作注意事项
1:sublime 安装 babel 插件可以 识别react代码,变色,使用javascipt(babel): 2:热更新:import React, {Component } from 'reac ...
- ubuntu安装sublime教程
1.安装Sublime Text 3 及常用的神器插件 ①首先添加sublime text 3的仓库:sudo add-apt-repository ppa:webupd8team/sublime-t ...
- bootstrap modal模态框的运用
http://www.ziqiangxuetang.com/bootstrap/bootstrap-modal-plugin.html 方法 下面是一些可与 modal() 一起使用的有用的方法. 方 ...