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 ...
随机推荐
- linux 读取物理寄存器
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/mman.h ...
- Gym 101630(NEERC 17) D.Designing the Toy
题目大意:给出三视图方向上分别能看到的正方形数a,b,c(1<=a,b,c<=100),在-100<=x,y,z<=100的范围内构造出满足情况的一种正方体的摆放方式 做法很简 ...
- JAVA爬取百度贴吧图片
package com.wang.xiaowei.utils; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.code ...
- Let the Balloon Rise map一个数组
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...
- leetcode:Reverse Words in a String【Python版】
class Solution: # @param s, a string # @return a string def reverseWords(self, s): ss = s.split(&quo ...
- 使用MVC5的Entity Framework 6入门 ---- 系列教程
使用MVC5的Entity Framework 6入门(十二)——为ASP.NET MVC应用程序使用高级功能 为ASP.NET MVC应用程序使用高级功能这是微软官方教程Getting Starte ...
- 利用用python构建 个性化签名
from tkinter import * from tkinter import messagebox,ttk from PIL import ImageTk import requests imp ...
- 一组十六进制的字符串每两个转成对应值的byte
/// <summary> /// 一组十六进制的字符串每两个转成对应值的byte,比如4142 会成 AB对应的byte列表 /// </summary> /// <p ...
- kafka 安装与配置
下载 地址:https://kafka.apache.org/downloads 这里下载的是kafka_2.11-0.11.0.1.tgz 解压 tar -xzf kafka_2.11-0.11.0 ...
- Android NDK R9 安装配置 无需Cygwin
转自:http://www.cr173.com/soft/66623.html NDK是一个工具集,可让您实现您的应用程序使用本机代码的语言,如C和C + +.Android NDK 是在SDK前面又 ...