【发布时间】:2016-01-19 07:19:21
【问题描述】:
我正在使用 solr 4.10。我必须根据字段提升和文档分数更改文档的相关性。为此,我知道我应该使用函数查询。以下是 schema 中 boost 字段的语法
<field name="boost" type="float" stored="true" indexed="false" default="1.0"/>
我的第一个问题是函数查询只能用于存储字段吗?
当我尝试使用上述架构时,如以下查询
http://localhost:8983/solr/select?q=bank&df=keywords&fl=id&sort=pow(score,%20boost)%20asc
有一些错误说像
sort param could not be parsed as a query, and is not a field that exists in the index:
然后我改变了架构像
<field name="boost" type="float" stored="true" indexed="true" default="1.0"/>
然后上面的问题消失了,但是查询出现了一个新的错误
http://localhost:8983/solr/select?q=bank&df=keywords&fl=id,pow(score,%20boost)
出现以下错误
<lst name="error">
<str name="msg">undefined field: "score"</str>
<int name="code">400</int>
</lst>
我哪里错了? 我是否正确更改了 boost 字段的属性?
【问题讨论】:
-
在对 schema.xml 文件进行更改后,您是否运行了索引器(完整索引)?
-
是的,我删除了所有文档并再次索引它们
标签: apache solr lucene solr-boost