【发布时间】:2018-12-13 01:51:21
【问题描述】:
我正在使用 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) 保存在以下位置 /Users/yatingrover/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)
我得到所有 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