Solr: QueryElevationComponent requires a unique StrFieldKeyField error

I recently installed solr. The sample index (found in apache-solr - #. #. # \ Example \ solr) seems to work, and after copying to my solr home directory, I can access it through the administration pages. However, when I try to implement a new index by replacing the contents of schema.xml with (taken from here ):

<?xml version="1.0" encoding="UTF-8" ?> <schema name="example" version="1.2"> <types> <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" /> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0" /> <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0" /> <fieldType name="text" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" /> <filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt" /> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" /> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1" /> <filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt" /> </analyzer> </fieldType> </types> <fields> <field name="fileid" type="int" indexed="true" stored="true" required="true" /> <field name="doctext" type="text" indexed="true" stored="false" required="false" /> <field name="title" type="text" indexed="true" stored="false" required="false" /> <field name="datecreated" type="date" indexed="true" stored="false" /> </fields> <uniqueKey>fileid</uniqueKey> <defaultSearchField>doctext</defaultSearchField> <solrQueryParser defaultOperator="OR" /> </schema> 

I get a configuration error, which seems to suggest that the unique KeyField should be implemented using the StrField type (something that I find it hard to believe, really?):

"HTTP Status 500 - Severe Solr configuration errors .... org.apache.solr.common.SolrException: QueryElevationComponent requires the scheme to have a unique KeyField implemented using StrField in org.apache.solr.handler. Component.QueryElevationComponent.inform (QueryElevationComponent.java:157) in org.apache.solr.core.SolrResourceLoader.inform (SolrResourceLoader.java:508) in ... "

My googling turned out to be very little to help, so I hope there may be someone here who could encounter this problem and / or have some ideas on how to solve it?

Thanks in advance for any advice, Bea.

+6
solr relevance
source share
2 answers

Yes, QueryElevationComponent currently requires a unique row key. This limitation is documented in the Solr quiz .

Here is the problem in the JIRA project.

+11
source share

If you are still looking for an answer,

In schema.xml include the following

 <fieldType name="uuid" class="solr.UUIDField" indexed="true" /> <field name="id" type="uuid" indexed="true" stored="true" default="NEW" /> 

In the elevate.xml file, use this identifier to match the search terms to the best result.

 <elevate> <query text="foo bar"> <doc id="4602376f-9741-407b-896e-645ec3ead457" /> </query> </elevate> 

Here 4602376f-9741-407b-896e-645ec3ead457 is the value in the "id" field of the document with the best rate. Wish, Solr allows us to specify any field of the primary key, for example employeeid or productid, for the indication in the elevate.xml file

-2
source share

All Articles