solr multivalued
2014-04-22 18:30
239 查看
http://blog.csdn.net/alen1985/article/details/8538942
solr的schema.xml配置文件在配置Filed的时候,有个属性:
MutiValued:true if this field may containmutiple values per documents,这个说明有点模糊,下面结合实际应用,列举两个不同的例子。
例子一:一个field有多个值,值来自同一filed
其中:
<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的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:CopyField multiValued
- 统计solr multivalued 字段中数目
- org.apache.solr.common.SolrException: ERROR: multiple values encountered for non multiValued copy
- Solr部分更新MultiValued的Date日期字段时报错及解决方案:Invalid Date String:'Mon Sep 14 01:48:38 CST 2015'
- solr multiValued的查询
- Functional Dependencies & MultiValued Dependency
- SOLR Performance Benchmarks – Single vs. Multi-core Index Shards
- solr 1.4.0 multi core deploy
- PB中multieditline空间的“~r~n"转"~n"
- multi-core solr deploy process(not complete)
- Solr fields sorting 排序相关(Integers, Longs, Floats, or String and multi-language 多语言相关)
- multi-core solr deploy process(not complete)
- solr multivalue的实现分析 推荐
- Solr Multivalue field的索引和搜索
- 【emWin】例程三十:窗口对象——Multiedit
- SOLR Performance Benchmarks – Single vs. Multi-core Index Shards
- WPF MultiBinding 给数据目标赋值后绑定无效的问题
- windows下tomcat+solr+ZooKeeper集群搭建
- solr 近实时搜索
- 关联容器:set multiset map multi…