6

Solr 3.6.1 を使用しています。整数値を含むSolrソートフィールドに使用する正しいフィールドタイプは何ですか? このフィールドは並べ替えにのみ必要であり、範囲クエリを実行することはありません。またはを使用する必要がありますintegersint

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 にデータを入力するためです。フィールドキャッシュの下の統計ページ (http://HOST:PORT/solr/CORE/admin/stats.jsp) で、並べsint替えが次のように保存されていることがわかります。

org.apache.lucene.search.FieldCache$StringIndex

一方、integer並べ替えは次のように保存されます

org.apache.lucene.search.FieldCache.DEFAULT_INT_PARSER

どちらがより少ないスペースを消費すると思いますか?


更新: Solr 3.6.1 schema.xml はie as としてint宣言されていますTrieIntField

<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>

上記のものは、古い solr バージョンのものです。

4

2 に答える 2

8

範囲クエリが必要ない場合は 、両方でソートが正しく機能するため、「整数」を使用してください

ドキュメンテーション:-

sint や sdouble などのソート可能な FieldType は、少し間違った名前です。上記の意味での並べ替えには必要ありませんが、RangeQuery クエリを実行するときに必要です。実際、Sortables は、数値を文字列として辞書順に正しく並べ替えるという概念を指します。つまり、これを行わないと、数字 1..10 は辞書式に 1,10, 2, 3... のように並べ替えられます。ただし、RangeQuery クエリを実行する必要がなく、フィールドでの並べ替えのみが必要な場合は、int または double または同等の適切なクラスを使用してください。時間とメモリを節約できます。

于 2012-11-14T03:52:55.650 に答える