问题
In my entity clas, I defined id:
@Field("id")
protected Long id;
then in solr4.0.0 schema.xml, i define:
<field name="id" type="long" indexed="true" stored="true" />
<uniqueKey>id</uniqueKey>
then solr throws exception on startup. If 'id' is defined as 'string' type, no exception. so my question is: what's the solution if i insisted on defining 'id' as long type.
回答1:
Check SOLR-2997
It seems QueryElevationComponent needs the Unique key in String format. So if you don't need it you can remove it.
回答2:
Just remove the below node in solrconfig.xml file:
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
来源:https://stackoverflow.com/questions/14208477/solr-4-0-0-define-uniquekey-id-uniquekey-as-a-long-type-throws-an-error-on