doublemc
doublemc

Reputation: 3311

Id field as long type

I'm trying to use Id field as Long and getting this error:

ERROR: Error CREATEing SolrCore 'brands': Unable to create core 
[brands] Caused by: uniqueKey field (id) can not be configured to use a 
Points based FieldType: plong

Here is my schema.xml:

<?xml version="1.0" encoding="UTF-8"?>
<schema name="brands-config" version="1.6">
<uniqueKey>id</uniqueKey>
<fieldType name="plong" class="solr.LongPointField" docValues="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>
<field name="name" type="string"/>
<field name="id" type="plong" multiValued="false" indexed="true" required="true" stored="true"/>
</schema>

My solrconfig.xml is basic one - only removed the part mentioned in this thread but it didn't help.

Is there any way to make my id field type long? I need it this way to avoid too much mapping.

Upvotes: 6

Views: 2679

Answers (2)

Denis E. Sanches
Denis E. Sanches

Reputation: 95

As described here you can't use a point based field as uniqueKey. Instead, you could use the string type.

Upvotes: 3

Jeeppp
Jeeppp

Reputation: 1573

I'm really not sure why you need to have long datatype. To answer your question Solr query elevation component uses the String as a key and hence your unique key cannot be a long.

If you need to work around on this then you might consider creating a copy field and have that as a long and use if for your operations.

Upvotes: -1

Related Questions