我正在使用Solr 3.6.1。什么是正确的字段类型用于包含整数值的Solr排序字段?我只需要这个字段进行排序,并且不会对它进行范围查询。我应该使用integer
还是sint
?什么是正确的Solr fieldType用于排序整数值?
我看到,在schema.xml中,有声明sint
类型:
<!-- Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly. -->
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
而integer
说以下内容:
<!-- numeric field types that store and index the text
value verbatim (and hence don't support range queries, since the
lexicographic ordering isn't equal to the numeric ordering) -->
<fieldType name="integer" class="solr.IntField" omitNorms="true"/>
我问这种情况的主要原因是因为每次的Solr排序我做的sint
字段(我有很多他们声明为动态字段)填充(不可配置)lucene fieldCache。我看到的统计数据页上sint
各种存储为
org.apache.lucene.search.FieldCache$StringIndex
而integer
各种存储为
org.apache.lucene.search.FieldCache.DEFAULT_INT_PARSER
我相信哪些消耗空间更少?
UPDATE:Solr的3.6.1 schema.xml中已宣布int
作为TrieIntField
即作为
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
该一个以上是从旧版本的solr。
您应该始终使用TrieIntField而不是IntField和SortableIntField:此类具有**多** **多内存效率的FieldCache impl – jpountz