I store identifiers integers as solr.StringField. It works like a charm,
as long as you don't need ranges of identifiers that differ in digit
length. If you do want to get ranges or sort them by identifier, I
suppose you rather pad them to a constant length with zeroes on the
left. I.e. in typical printf Syntax something like: "%012d" if you want
12 decimal digits, or "%012X" if you prefer hexadecimals.
<field name="buchID" type="id" indexed="true" stored="true"/>
<fieldType name="id" class="solr.StrField"/>
<uniqueKey>buchID</uniqueKey>
I guess you could try TrieLongField, even though that's deprecated for a
while now.
I suppose the *proper* way would be using UUIDs. Don't know how that
works, though.
Am 02.07.25 um 16:28 schrieb Marc:
Hi there,
I'm struggeling with a LongPointField that I would like to use fir a
document ID value:
<fieldType name="long_dv" class="solr.LongPointField"
docValues="true" />
<field name="id" type="long_dv" indexed="true" stored="true"
docValues="true" required="true" />
<uniqueKey>id</uniqueKey>
Trying to create a core with this I only get this error:
Error CREATEing SolrCore 'test': Unable to create core [test] Caused
by: uniqueKey field (id) can not be configured to use a Points based
FieldType: long
The core creation immediately works fine when I change the fieldType
line above to:
<fieldType name="long_dv" class="solr.TrieLongField"
docValues="true" />
But the reference guide (cf.
https://solr.apache.org/guide/solr/latest/indexing-guide/field-types-included-with-solr.html)
says:
TrieLongField: Use LongPointField instead.
So my question is: How can I use a document ID of type long in Solr
9.8 without either running into an error or using a deprecated long type?
Any help would be appreciated.
Thanks,
Marc