从Solr DocumentExpressionDictionaryFactory获取引用无效的异常

ftf50wuq  于 2024-01-07  发布在  Solr
关注(0)|答案(2)|浏览(259)

我正在使用Solr 6.2。我试图在Solr搜索组件中配置多个搜索器定义,并获得错误信息,如:

  1. java.lang.IllegalArgumentException: Invalid reference 'softId_suggest'
  2. at org.apache.lucene.expressions.SimpleBindings.getValueSource(SimpleBindings.java:84)
  3. at org.apache.lucene.expressions.ExpressionValueSource.<init>(ExpressionValueSource.java:45)
  4. at org.apache.lucene.expressions.Expression.getValueSource(Expression.java:80)
  5. at org.apache.solr.spelling.suggest.DocumentExpressionDictionaryFactory.fromExpression(DocumentExpressionDictionaryFactory.java:107)
  6. at org.apache.solr.spelling.suggest.DocumentExpressionDictionaryFactory.create(DocumentExpressionDictionaryFactory.java:92)
  7. at org.apache.solr.spelling.suggest.SolrSuggester.build(SolrSuggester.java:174)
  8. at org.apache.solr.handler.component.SuggestComponent$SuggesterListener.buildSuggesterIndex(SuggestComponent.java:528)
  9. at org.apache.solr.handler.component.SuggestComponent$SuggesterListener.newSearcher(SuggestComponent.java:508)
  10. at org.apache.solr.core.SolrCore.lambda$3(SolrCore.java:1863)
  11. at java.util.concurrent.FutureTask.run(Unknown Source)
  12. at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
  13. at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  14. at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  15. at java.lang.Thread.run(Unknown Source)

字符串
在我的Solrtlog.xml中的配置是:

  1. <field name="softId_suggest" type="int" indexed="true" stored="true" />
  2. <copyField source="softId" dest="softId_suggest" />

  1. <lst name="suggester">
  2. <str name="name">MySuggest</str>
  3. <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
  4. <str name="dictionaryImpl">DocumentExpressionDictionaryFactory</str>
  5. <str name="field">suggest_name</str>
  6. <str name="highlight">false</str>
  7. <str name="weightExpression">softId_suggest</str>
  8. <str name="indexPath">analyzingInfixSuggesterIndexDir</str>
  9. <str name="suggestAnalyzerFieldType">text_suggest</str>
  10. </lst>


从lucene的源代码中我知道,似乎字段softId_suggest是null,但如何配置它是正确的?

vhipe2zx

vhipe2zx1#

在您的描述中,您说您在solrconfig.xml中配置了softId_suggest。但字段是在managed-schema文件中配置的。因此,要么这就是问题所在,要么您需要更正该问题。
如果定义正确,请确保您已经重新加载了核心,重新导入并提交。
然后,我将检查管理员UI的模式页面,并确保该字段既存在于XML中,也加载了一些值(* 加载术语信息 * 按钮)。

aoyhnmkz

aoyhnmkz2#

resolution:在solrd.xml中的weightExpression所使用的字段的模式中,将docValues设置为false

  1. <field name="weight" type="pdouble" docValues="false"/>

字符串
验证字段设置是否正确的一种简单方法是设置

  1. <str name="weightExpression">(ln(weight))</str>


然后,您可能会得到一个不同的(更有帮助!)错误,如

  1. "Type mismatch: weight was indexed as SORTED_NUMERIC"


这是我们比较熟悉的领域,我们已经准确地指出了这个问题。简单地docValues=false就可以解决这个问题。

展开查看全部

相关问题