I am using solr techproducts example.
I have created a field type
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
and then I have created a field
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
I have kept the externalFieldFile(external_entryRankFile.txt) in the following location /Users/yatingrover/softwares/solr-7.5.0/example/techproducts/solr/techproducts/data
Contents of the file external_entryRankFile.txt
TWINX2048-3200PRO=10
IW-02=1500
VA902B=170000
now I am running this query
http://localhost:8983/solr/techproducts/select?q=*&sort={!func}pageViews%20desc
also when I am running the query
http://localhost:8983/solr/techproducts/select?q=*&sort={!func}pageViews%20desc&fl=id,%20score,%20field(pageViews)
I am getting all pageViews =0
sample response
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
},
The results are not getting sorted on the base of external field file, can anyone point out what I am missing?