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

ftf50wuq  于 12个月前  发布在  Solr
关注(0)|答案(2)|浏览(181)

我正在使用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)

字符串
在我的Solrtlog.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是null,但如何配置它是正确的?

vhipe2zx

vhipe2zx1#

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

aoyhnmkz

aoyhnmkz2#

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

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

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

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


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

"Type mismatch: weight was indexed as SORTED_NUMERIC"


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

相关问题