1、配置schema.xml文件 linux
一、添加fieldType apache
<types> <!-- other field types --> <fieldType name="uuid" class="solr.UUIDField" indexed="true" /></types>
二、添加主鍵id字段配置(註釋或者刪除原來的id字段配置,切記) ui
<field name="id" type="uuid" indexed="true" stored="true" required="true" multiValued="false" />
2、配置solrconfig.xml文件 code
一、註釋掉如下的配置,緣由及可能產出的異常參考:https://issues.apache.org/jira/browse/SOLR-3398 xml
<searchComponent name="elevator" class="solr.QueryElevationComponent" > <str name="queryFieldType">string</str> <str name="config-file">elevate.xml</str> </searchComponent>
<updateRequestProcessorChain name="uuid"> <processor class="solr.UUIDUpdateProcessorFactory"> <str name="fieldName">id</str> </processor> <processor class="solr.RunUpdateProcessorFactory" /></updateRequestProcessorChain>
<requestHandler name="/update" class="solr.UpdateRequestHandler"> <!-- See below for information>