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 ...
随机推荐
- oracle错误:1067进程意外终止
oracle错误:1067进程意外终止我Oracle安装完了之后可以运行的 ,过了一段时间不可以了,就上网找了一下,原来是自己的ip已经改变.我一直使用IP地址的. 将D:\oracle\produc ...
- 跟我一起玩Win32开发(12):使用控件——单选按钮
今天,咱们还是接着玩“控件斗地主”,这是我原创的超级游戏,有益身心健康,玩一朝,十年少. 哦,对,脑细胞极速运动了一下,想起了一个问题,这个破问题虽然网上有很多种解决方案,但是,并没有让所有人都解决问 ...
- nginx添加模块
[root@VM_0_3_centos nginx]# ./sbin/nginx -V nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 ...
- Charles对移动APP抓包(https)
1.下载安装Charles 2.设置代理 (1)查看默认端口:Proxy->Proxy Settings 在这个页面会看到HTTP Proxy的默认端口是8888 (2)查看当前电脑的IP:H ...
- python实现判断素数
import math def is_prime_1(n): if n <= 1: return False for i in range(2, int(math.sqrt(n) + 1)): ...
- HTML中div的悬浮标题
<div title="我是鼠标悬停文字">我是一个DIV</div> <div class="diggao" title=&qu ...
- 521 Longest Uncommon Subsequence I 最长特殊序列 Ⅰ
给定两个字符串,你需要从这两个字符串中找出最长的特殊序列.最长特殊序列定义如下:该序列为某字符串独有的最长子序列(即不能是其他字符串的子序列).子序列可以通过删去字符串中的某些字符实现,但不能改变剩余 ...
- VS2015调用低版本lib库出现“无法解析的外部符号 __snprintf ”问题的解决
VS2015在调用低版本lib库出现有时会出现“无法解析的外部符号 __snprintf ”的问题,解决方法是加入lib库“legacy_stdio_definitions.lib”到工程.
- Web前端攻防,一不小心就中招了
随着各浏览器安全功能的提高,前端防御面临的问题也没有之前那么复杂,但浏览器的防御措施并不能百分百的保证网站的安全. 浏览器的XSS Auditor,使得反射型xss几乎被废:CSP(Content-S ...
- viewport实现html页面动态缩放/meta viewport/viewport
页面默认缩放比例为1,最小宽度为375px,在小于375px出现水平滚动条的时候重新计算显示比例缩小界面, <!DOCTYPE html> <html lang="en&q ...