Solr外部字段文件未对结果进行排序



我使用的是solr-techproducts示例。

我创建了一个字段类型

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-field-type" : {
"name":"entryRankFile",
"keyField":"id",
"defVal":"0",
"stored":"false",
"indexed":"false",
"class":"solr.ExternalFileField"
}
}' http://localhost:8983/api/cores/techproducts/schema

然后我创建了一个字段

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-field":{
"name":"pageViews",
"type":"entryRankFile",
"indexed":"true",
"stored":"true" }
}' http://localhost:8983/api/cores/techproducts/schema

我将externalFieldFile(external_entryRankFile.txt(保存在以下位置/用户/yatingover/softwares/solr-7.5.0/example/techproducts/solr/techproducts/data

external_entryRankFile.txt 文件的内容

TWINX2048-3200PRO=10
IW-02=1500
VA902B=170000

现在我正在运行这个查询

http://localhost:8983/solr/techproducts/select?q=*&sort={!func}pageViews%20desc

当我运行查询时

http://localhost:8983/solr/techproducts/select?q=*&sort={!func}pageViews%20desc&fl=id,%20score,%20field(pageViews)

我正在获取所有页面视图=0

样本响应

response: {
numFound: 32,
start: 0,
maxScore: 1,
docs: [
{
id: "TWINX2048-3200PRO",
score: 1,
field(pageViews): 0
},
{
id: "VS1GB400C3",
score: 1,
field(pageViews): 0
},
{
id: "VDBDB1A16",
score: 1,
field(pageViews): 0
},
{
id: "MA147LL/A",
score: 1,
field(pageViews): 0
},

结果没有根据外部字段文件进行排序,有人能指出我遗漏了什么吗?

根据文档

文件本身位于Solr的索引目录中,默认情况下是$SOLR_HOME/data。文件名应为external_fieldname或external_fieldname.*。对于上面的示例,文件可以命名为external_entryRankFile或external_entryRankFile.txt。

他们提到文件名应该是external_fieldname。如果您将文件名更改为external_pageViews.txt,这将解决您的问题。

最新更新