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

问题描述 投票:0回答:2

我使用的是solr 6.2。我正在尝试在 Solr 搜索组件中配置多个建议器定义,并收到如下错误信息:

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

我的 Solrconfig.xml 中的配置是:

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

 <lst name="suggester">
   <str name="name">MySuggest</str>
   <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
   <str name="dictionaryImpl">DocumentExpressionDictionaryFactory</str>
   <str name="field">suggest_name</str>
   <str name="highlight">false</str>
   <str name="weightExpression">softId_suggest</str>       
   <str name="indexPath">analyzingInfixSuggesterIndexDir</str>
   <str name="suggestAnalyzerFieldType">text_suggest</str>
 </lst>

从lucene的源码中我知道好像字段

softId_suggest
为空,但是如何配置它是正确的?

solr
2个回答
1
投票

在您的描述中,您说您在solrconfig.xml中配置了softId_suggest。但这些字段是在“托管架构”文件中配置的。所以,要么这就是问题所在,要么你需要纠正这个问题。 如果定义正确,请确保您已重新加载核心,重新运行导入并提交。

然后,我会检查管理 UI 的架构页面,并确保该字段既存在于下拉列表中,又加载了一些值(

加载术语信息

按钮)。


0
投票

此 solrconfig.xml 条目有效:

<str name="weightExpression">((1000 * 2) + 4)</str>

但是,这不起作用:

<str name="weightExpression">((weight * 2) + 4)</str>

其中权重在 schema.xml 中定义为

<field name="weight" type="pdoubles" default="4.0" indexed="true" docValues="true" stored="true"/>

错误内容为:-

"Invalid reference 'weight' org.apache.lucene.expressions.SimpleBindings.getDoubleValuesSource(SimpleBindings.java:104)"

© www.soinside.com 2019 - 2024. All rights reserved.