以下是针对schema.xml 配置文件的剖析:
1. <types></types>这个标签和它的意义一样,是用来表示数据有哪些类型,这些类型当然是solr内部定义的类型和自定义类型。
2. <!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
和他上面解释一样,string类型是不分词的,要建索引,要存储
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
3.数值类型,有如下几个类型是默认数值类型,如果想用于排序请用 tint/tfloat/tlong/tdouble类型
<!-- Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types. --> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
4.时间类型:如果想用于快速排序查询,用tdate(看到这里我的排序没用tdate,得改啊。。)
Note: For faster range queries, consider the tdate type
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
<!-- A Trie based date field for faster date range queries and date faceting. -->
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
5.专门用于分词的字段。在里面包含了定义使用什么分词器,可以手工定制。
<fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
<!--建索引用到的分词器,我用的是IKTokenizerFactory,中文分词-->
<analyzer type="index">
<!--<tokenizer class="solr.WhitespaceTokenizerFactory"/>-->
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
add enablePositionIncrements=true in both the index and query
analyzers to leave a 'gap' for more accurate phrase queries.
-->
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<!--<analyzer type="query">
<!-- <tokenizer class="solr.WhitespaceTokenizerFactory"/>-->
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<!--查询用到的分词器IKTokenizerFactory,为了支持中文查询,这是必须的。-->
<analyzer type="query">
<!-- <tokenizer class="solr.WhitespaceTokenizerFactory"/>-->
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
其他几个类别都是不常用的,也是通过分词器来定义不同的类别。和第五个类似。
6.索引字段名称定义。
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the
<types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
boosting for the field, and saves some memory). Only full-text
fields or fields that need an index-time boost need norms.
termVectors: [false] set to true to store the term vector for a
given field.
When using MoreLikeThis, fields used for similarity should be
stored for best performance.
termPositions: Store position information with the term vector.
This will increase storage costs.
termOffsets: Store offset information with the term vector. This
will increase storage costs.
default: a value that should be used if no value is specified
when adding a document.
-->
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
<!-- <field name="name" type="textgen" indexed="true" stored="true"/>-->
<field name="alphaNameSort" type="alphaOnlySort" indexed="true" stored="false"/>
<field name="manu" type="textgen" indexed="true" stored="true" omitNorms="true"/>
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="features" type="text" indexed="true" stored="true" multiValued="true"/>
<field name="includes" type="text" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
<field name="weight" type="float" indexed="true" stored="true"/>
<!-- <field name="price" type="float" indexed="true" stored="true"/>-->
<field name="popularity" type="int" indexed="true" stored="true" />
<field name="inStock" type="boolean" indexed="true" stored="true" />
</fields>
id:是索引字段的唯一标识。
termVectors="true"属性主要用于相关搜索。
multiValued="true"属性,一般用于多个字段组成一个字段的情况。
<field name="content_type" type="text" indexed="true" stored="true" multiValued="true"/>
一般用于查询的字段定义为multiValued。
7. <dynamicField name="*_i" type="int" indexed="true" stored="true"/>表示动态字段,暂时没用到。
分享到:
相关推荐
包括solr的所有资源文件文件清单如下: IKAnalyzer.cfg.xml ik-analyzer-solr5-5.x.jar solr-analyzer-ik-5.1.0.jar managed-schema mysql-connector-java-5.1.7-bin.jar solrconfig.xml data-config.xml ext.dic ...
Solr 5.0.0易于使用云核心和自动托管模式进行部署,但无需复制任何schema.xml文件。 Solr 5.0.0可以使用Schema REST API编辑核心的配置。 Solr 5.0.0打破了Haystack版本2.3.1,因为默认情况下它使用托管模式,并且...
在X:\Tomcat 6.0\conf\Catalina\localhost下(目录不存在则手工建)创建配置文件solr.xml,内容为…… 4、配置索引数据格式 在X:\solr\solr\conf当中有schema.xml文件,可以配置索引数据格式。 5、运行solr 启动...
5.配置文件分析 9 5.1 schema.xml 9 5.1.1 文件分析 9 5.1.2 文档注释 13 5.2 solrconfig.xml 16 6.Solr缓存 18 6.1 filterCache 18 6.2 queryResultCache 18 6.3 documentCache 19 7.solrj wiki 19 7.1 SolrJ/Solr ...
用户可以通过http请求,向搜索引擎服务提供一定格式的xml文件,生成索引;也可以通过http get 操作提供查找请求,并得到xml格式的返回结果 2.,solr特点 Solr是一个高性能,采用java语言,基于Lucene开发的全文...
里面有关于solr环境搭建的详细文档说明,还有schema.xml,solrconfig.xml这两个文件里的配置说明,还有创建索引,删除索引的代码。及性能的优化。
2.4 配置文件说明 23 2.4.1 schema.xml 24 2.4.2 solrconfig.xml 25 3 Solr的应用 29 3.1 SOLR应用概述 29 3.1.1 Solr的应用模式 29 3.1.2 SOLR的使用过程说明 30 3.2 一个简单的例子 30 3.2.1 Solr Schema 设计 30 ...
2.将`resources`目录下的5个配置文件放入solr服务的`Jetty`或`Tomcat`的`webapp/WEB-INF/classes/`目录下; ```console ① IKAnalyzer.cfg.xml ② ext.dic ③ stopword.dic ④ ik.conf ⑤ dynamicdic.txt 3. ...
-outputFile --outputType其中: inputFile-要读取的配置文件inputType-输入配置类型outputFile-输出配置文件outputType-输出配置类型inputType和outputType属性可以采用以下值: solr-用于Solr schema.xml elastic...
Solr4.3.1配置好的Solr,分词器使用IK。使用步骤:拷贝solr目录到web服务器,如:tomcat的webapp目录下...根据业务配置索引字段,在schema.xml文件中。修改solr_config.xml,配置索引提交的频率。启动web服务器,访问:
4.修改 /opt/cdhsolr/fuser/conf/schema.xml文件,在其中添加 <!--配置IK分词器--> 引用 <fieldType name="text_ik" class="solr.TextField"> <!--索引时候的分词器--> ...
4.修改 /opt/cdhsolr/fuser/conf/schema.xml文件,在其中添加 <!--配置IK分词器--> 引用 <fieldType name="text_ik" class="solr .TextField"> <!--索引时候的分词器--> ...
在solrcode的schema.xml文件中的配置如下: 配置中文分词器的fieldType: <fieldType name="text_ik" class="solr.TextField"> <analyzer type="index" isMaxWordLength="false" class="org.wltea.analyzer.lucene....
schema.xml,在SolrCore的conf目录下,它是Solr数据表配置文件,它定义了加入索引的数据的数据类型的。主要包括FieldTypes、Fields和其他的一些缺省设置。field:进行索引,需要创建document,document中包括了很多...
2. 引入分词器的jar文件:在`server/solr/RD-Product/conf/solrconfig.xml`中配置如下信息,将`rd-lib`这个文件夹下的所有jar包引入到服务中。 <!-- 引入"contrib/rd-lib/"下所有jar文件 --> ${solr.install.dir:../...
Schema free:可以向服务器提交任意结构的JSON对象,Solr中使用schema.xml指定了索引结构; 多索引文件支持:使用不同的index参数就能创建另一个索引文件,Solr中需要另行配置; 分布式:Solr Cloud的配置比较...
通过对 Solr 进行适当的配置, 某些情况下可能需要进行编码,Solr 可以阅读和使用构建到其他 Lucene 应用程序中的索引。此 外,很多 Lucene 工具(如 Nutch、 Luke)也可以使用 Solr 创建的索引 Solr 的特性包括: 高级...
│ 12.nginx的配置文件-通过端口号区分虚拟机.avi │ 13.通过域名配置虚拟机.avi │ 淘淘商城第二天笔记.docx │ ├─03.第三天 │ 01.课程回顾.avi │ 02.课程计划.avi │ 03.什么是反向代理.avi │ 04.nginx的...
将solr-4.7.1/example/solr/collection1/conf/schema.xml文件中所有的 <tokenizer class="solr.WhitespaceTokenizerFactory"/>和 <tokenizer class="solr.StandardTokenizerFactory"/>全部替换为 ...