Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the correct Solr fieldType to use for sorting integer values?
    primarykey
    data
    text
    <p>I am using Solr 3.6.1. What is the correct field type to use for a Solr sort field containing integer values? I need this field only for sorting and will never do range queries on it. Should I use <code>integer</code> or <code>sint</code>?</p> <p>I see that in schema.xml, there is <code>sint</code> type declared as: </p> <pre><code> &lt;!-- 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. --&gt; &lt;fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/&gt; </code></pre> <p>whereas <code>integer</code> says the following:</p> <pre><code> &lt;!-- 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) --&gt; &lt;fieldType name="integer" class="solr.IntField" omitNorms="true"/&gt; </code></pre> <p>The main reason I am asking this is because every Solr sort I do on an <code>sint</code> field (I have lots of them declared as dynamic fields) populates the (unconfigurable) lucene fieldCache. I see on the stats page (http://HOST:PORT/solr/CORE/admin/stats.jsp) under fieldCache that <code>sint</code> sorts are stored as </p> <p><code>org.apache.lucene.search.FieldCache$StringIndex</code></p> <p>whereas <code>integer</code> sorts are stored as </p> <p><code>org.apache.lucene.search.FieldCache.DEFAULT_INT_PARSER</code></p> <p>which I believe consumes less space?</p> <hr> <p>UPDATE: Solr 3.6.1 schema.xml has <code>int</code> declared as <code>TrieIntField</code> i.e. as</p> <p><code>&lt;fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/&gt;</code></p> <p>The one above was from an older solr version.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload