Solr:QueryElevationComponent 需要 StrField uniqueKeyField 错误

发布于 2024-09-17 12:43:24 字数 3381 浏览 3 评论 0原文

我最近安装了solr。示例索引(在 apache-solr-#.#.#\example\solr 中找到)似乎可以工作,并且一旦复制到我的 solr 主目录,我就可以通过管理页面访问它。但是,当我尝试通过替换 schema.xml 内容来实现新索引时(取自 这里):

<?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>

我收到一个配置错误,这似乎表明 uniqueKeyField 必须使用 StrField 类型来实现(我很难相信实际上是case?)):

“HTTP 状态 500 - solr 配置中出现严重错误。 ... org.apache.solr.common.SolrException:QueryElevationComponent 要求架构具有使用 org.apache.solr 上的 StrField 实现的 uniqueKeyField。 handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:157) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:508) at..."

我的谷歌搜索几乎没有发现帮助,所以我希望这里可能有人遇到过这个问题和/或有一些解决方案的想法?

预先感谢您的任何建议,Bea。

I recently installed solr. The example index (found at apache-solr-#.#.#\example\solr) seems to work, and, once copied to my solr home directory, I am able to access it through the admin pages. However when I try to implement a new index by replacing the schema.xml content 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 am receiving a configuration error, which seems to suggest that the uniqueKeyField must be implemented with a StrField type (something I find hard to believe is actually the case?)):

"HTTP Status 500 - Severe errors in solr configuration. ... org.apache.solr.common.SolrException: QueryElevationComponent requires the schema to have a uniqueKeyField implemented using StrField at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:157) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:508) at..."

My googling has turned up very little to help, so I am hoping there might be someone around here who might have come across this issue and/or have some ideas how to resolve it?

Thanks in advance for any advice, Bea.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青瓷清茶倾城歌 2024-09-24 12:43:24

是的,目前 QueryElevationComponent 需要一个字符串唯一键。此限制记录在 Solr wiki 中。

这是项目 JIRA 中的问题

Yes, at the moment QueryElevationComponent requires a string unique key. This limitation is documented in the Solr wiki.

Here's the issue in the project JIRA.

仅此而已 2024-09-24 12:43:24

如果您仍在寻找答案,

请在 schema.xml 中包含以下内容

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

在 elevate.xml 中,使用此 ID 将您的搜索词映射到最佳匹配结果 。

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

这里,4602376f-9741-407b-896e-645ec3ead457 是最佳匹配文档的“id”字段中的值。希望 Solr 允许我们指定任何主键字段,例如在 elevate.xml 中指定的employeeid或productid

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 elevate.xml, use this ID to map your search term to the best bet 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 best bet document. Wish, Solr allows us to specify any primary key field , say employeeid or productid for specifying in the elevate.xml

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文