solr中的schema.xml(managed-schema)文件解读
solr 7.2.1版本managed-schema文件示例
<uniqueKey>id</uniqueKey>
唯一键字段,solr对每一个文档都赋予一个唯一标识符字段,避免产生重复索引,
我们可以将不重复且不变的字段设置为solr索引文档的主键
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<!-- docValues are enabled by default for long type so we don't need to index the version field -->
<field name="_version_" type="plong" indexed="false" stored="false"/>
<field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
<field name="_text_" type="text_general" indexed="true" stored="false" multiValued="true"/>
<field></field>代表索引文档的字段, name属性为字段名称(该名称唯一), type字段为该字段索引解析所用的分词器,
indexed为是否进行索引, stored为是否储存该字段的值用于日后的查询, multiValued为该字段是否有多个值
<dynamicField name="*_i" type="pint" indexed="true" stored="true"/>
<dynamicField name="*_is" type="pints" indexed="true" stored="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true" />
<dynamicField name="*_ss" type="strings" indexed="true" stored="true"/>
<dynamicField name="*_l" type="plong" indexed="true" stored="true"/>
<dynamicField>与field意义相同,但其代表的是动态字段
动态字段:如果几个字段的属性处理name值不同,type indexed stored 等属性完全相同,
则可以只配置一个动态字段以减少配置,动态字段以*_开头或以_*结尾,例如*_s s_*
当配置了
<dynamicField name="*_s" type="string" indexed="true" stored="true" />
时传入 name1_s 和 name2_s 两个字段的名称则都会匹配
但其在查询时必须明确指定字符串的字段
<field name="queryFieldCopy" type="text_en" indexed="true" stored="false" multiValued="true" /> <copyField source="_text_" dest="queryFieldCopy"/>
<copyField source="_root_" dest="queryFieldCopy"/>
<copyField> 复制字段,solr的复制字段允许将一个或多个字段值填充到一个字段中
将多个字段内容填充到一个字段
对同一字段内容进行不同的文本分析,创建一个新的可搜索字段
source为源字段 dest为目标字段
即将_text_字段和_root_字段复制到了queryFieldCopy字段,那么在对queryFieldCopy字段的搜索就相当于搜索了_text_和_root_两个字段
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymGraphFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.FlattenGraphFilterFactory"/>
-->
<!-- Case insensitive stop word removal.
-->
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="lang/stopwords_en.txt"
/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
<filter class="solr.EnglishMinimalStemFilterFactory"/>
-->
<filter class="solr.PorterStemFilterFactory"/>
</analyzer> <analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="lang/stopwords_en.txt"
/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
<filter class="solr.EnglishMinimalStemFilterFactory"/>
-->
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
Solr 分析器被指定为 schema.xml 配置文件中的<fieldType>元素的子元素(在与 solrconfig. xml 相同的 conf/ 目录中)。
solr中的schema.xml(managed-schema)文件解读的更多相关文章
- idea中自定义设置xml的头文件的内容
因为在idea中新建的xml默认的头文件,有时候并不是我们需要的这时候可以通过自定义来解决. 如搭建hibernate的实体类的映射xml. 首先 fiel→settings出现 如下框框 在上面搜索 ...
- 解决 IDEA 中src下xml等资源文件无法读取的问题
该问题的实质是,idea对classpath的规定. 在eclipse中,把资源文件放在src文件夹下,是可以找到的: 但是在idea中,直接把资源文件放在src文件夹下,如果不进行设置,是不能被找到 ...
- solr官方文档翻译系列之schema.xml配置介绍
常见的元素 <field name="weight" type="float" indexed="true" stored=" ...
- SOLR企业搜索平台 三 (schema.xml配置和solrj的使用)
标签:solrj 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://3961409.blog.51cto.com/3951409/8 ...
- Solr的学习使用之(二)schema.xml等配置文件的解析
上一篇文章已经讲解了如何部署Solr,部署是部署完了,可是总觉得心里空空的,没底,里面有N多配置文件,比如schema.xml.solrConfig.xml.solr.xml and so on……都 ...
- Spring的配置文件ApplicationContext.xml配置头文件解析
Spring的配置文件ApplicationContext.xml配置头文件解析 原创 2016年12月16日 14:22:43 标签: spring配置文件 5446 spring中的applica ...
- 我与solr(五)--关于schema.xml中的相关配置的详解
先把文件的代码贴上来: <?xml version="1.0" encoding="UTF-8" ?> <!-- 版权说明... --> ...
- Solr中Schema.xml中文版
<?xml version="1.0" encoding="UTF-8" ?> <!-- Licensed to the Apache Sof ...
- Solr 06 - Solr中配置使用IK分词器 (配置schema.xml)
目录 1 配置中文分词器 1.1 准备IK中文分词器 1.2 配置schema.xml文件 1.3 重启Tomcat并测试 2 配置业务域 2.1 准备商品数据 2.2 配置商品业务域 2.3 配置s ...
随机推荐
- PHP数组直接相加和array_merge的区别
array_merge是很常用的数组合并函数,但是两个数组直接相加对开发也是很有帮助的,两者之间有什么差别,这里记录一下: 首先是以数字为索引 array_merge会将两个数组按照先后顺序组成一个新 ...
- python计算代码运行时间的装饰器
import time def cal_time(func): def wrapper(*args, **kwargs): t1 = time.time() result = func(*args, ...
- Super Mario 树状数组离线 || 线段树
Super Mario Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- sql server group by 分组带sum avg求和需要注意的一点
这是在写SQL语句遇到的一个sum 和group bu分组的问题
- AJPFX关于java中的方法
java中的方法和c语言中的函数类似,是新手入门面向对象之前的内容最大的难关如何写方法 1,明确返回值类型 2,明确参数列表 * 修饰符:目前就用 public stati ...
- 【学习笔记】深入理解js原型和闭包(17)——补this
本文对<深入理解js原型和闭包(10)——this>一篇进行补充,原文链接:https://www.cnblogs.com/lauzhishuai/p/10078307.html 原文中, ...
- The lion king 经典句型摘录
What am I going to do with him? Everything the light touches is our kingdom. But I thought a king ca ...
- Windows各个文件夹介绍
windows文件介绍 总结 ├WINDOWS │ ├-system32(存放Windows的系统文件和硬件驱动程序) │ │ ├-config(用户配置信息和密码信息) │ │ │ └-system ...
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 忘记mysql密码
[root@mysql-db03 ~]# mysql -uroot -poldboy123Warning: Using a password on the command line interface ...
- app支付宝授权登录获取用户信息
由后台进行地址的拼接(前台进行授权) // 生成授权的参数 String sign = ""; Long userId1 = SecurityUser.getUserId(); S ...