Apache Solr schema.xml

Last updated on
30 April 2025

Reference: http://wiki.apache.org/solr/SchemaXml

Sint and integer

There are two integer types, 'sint' and 'integer'. On an integer, you cannot
do a range check (that makes sense).
But! Lucene sort makes an array of integers for every record. On an integer
field, it creates an integer array. On any other kind of field, each array
item has a lot more.

So, if you want fast sorts with small memory footprint, you want 'integer' =
20070310, not 'sint' = 20070310. We did exactly this for exactly this
reason.

Reference: http://www.nabble.com/Help-optimizing-td17037362.html#a17095631

In lucene, all the data is stored as strings, so if you have a field
defined as integer or sint, in lucene are strings, and if you try to
sort numbers represented as strings what happens is this:

example numbers: 1,2,3,4,5,6,7,8,9,10,11,12,13.
ordered as strings: 1,10,11,12,13,2,3,4,5,6,7,8,9

That's why there is a field type called sint, that means sortable int.
Is the same as int with the difference that it will order the numbers
properly.

example numbers: 1,2,3,4,5,6,7,8,9,10,11,12,13.
order being int: 1,10,11,12,13,2,3,4,5,6,7,8,9
order being sint: 1,2,3,4,5,6,7,8,9,10,11,12,13.

Reference http://markmail.org/message/ib4gevqevjilqz7n

Help improve this page

Page status: Not set

You can: