为什么Solr default多值为true?
在v1.4中,如果我在Solr模式中定义一个字段:为什么Solr default多值为true?,solr,multivalue,Solr,Multivalue,在v1.4中,如果我在Solr模式中定义一个字段: <field name="MTID" type="string" /> 此字段将是单值字段。而在v3.5中,它默认为多值。原因是什么?Solr项目是否做出了这个决定 我即将跳入Solr 4或Solr 5,这种现象是否仍然存在 注意:我目前正在Win7下的Tomcat 6.0上使用Solr 3.5。在两个不同版本的Solr中使用完全相同的配置文件将为模式属性(如多值)产生相同的默认行为。如果你看到的是不同的行为,那么你在某
<field name="MTID" type="string" />
此字段将是单值字段。而在v3.5中,它默认为多值。原因是什么?Solr项目是否做出了这个决定
我即将跳入Solr 4或Solr 5,这种现象是否仍然存在
注意:我目前正在Win7下的Tomcat 6.0上使用Solr 3.5。在两个不同版本的Solr中使用完全相同的配置文件将为模式属性(如
多值
)产生相同的默认行为。如果你看到的是不同的行为,那么你在某个地方有一个下降趋势
1)
声明中属性的默认行为首先由相应的
上的属性决定。由于您的问题没有指定
字符串的
声明在两个schema.xml
文件中是什么,因此这两个配置可能不同
2) 如果在
或
定义上未定义多值属性,则默认行为来自
指定的类属性(例如:solr.StrField
)
3) 对于内置的Solr字段类型(例如:Solr.StrField
),默认行为完全由schema.xml
的version
属性驱动。如Solr附带的示例schema.xml
所述
<schema name="example" version="1.5">
<!-- attribute "name" is the name of this schema and is only used for display purposes.
version="x.y" is Solr's version number for the schema syntax and
semantics. It should not normally be changed by applications.
1.0: multiValued attribute did not exist, all fields are multiValued
by nature
1.1: multiValued attribute introduced, false by default
1.2: omitTermFreqAndPositions attribute introduced, true by default
except for text fields.
1.3: removed optional field compress feature
1.4: autoGeneratePhraseQueries attribute introduced to drive QueryParser
behavior when a single string produces multiple tokens. Defaults
to off for version >= 1.4
1.5: omitNorms defaults to true for primitive field types
(int, float, boolean, string...)
-->
…因此,如果配置中的
和
声明相同,最后要检查的是您是否修改了
根元素上的version
属性的值。谢谢您的回复。我记得我曾经在Schema标记中将version设置为3.x,以启用Solr的某些功能,因为它是中文字符。也许这就是原因。我会根据你的建议去检查我的配置。如果这确实是原因。我会回来投票给你作为最佳答案!这个问题困扰了我一段时间。再次感谢!