I am using Solr 7.4.0, and using LIBLINEAR to do the training for the LTR model based on this example: https://github.com/bloomberg/lucene-solr/blob/master-ltr/solr/contrib/ltr/example/README.md
However, I found that when I wanted to train for solr filter query with the class SolrFeature, I will get the following error saying that the model lacks weight(s):
Exception: Status: 400 Bad Request
Response: {
"responseHeader":{
"status":400,
"QTime":1},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.ltr.model.ModelException"],
"msg":"org.apache.solr.ltr.model.ModelException: Model myModel lacks weight(s) for [category]",
This is how I define it in my feature JSON file:
{
"store" : "myFeatures",
"name" : "category",
"class" : "org.apache.solr.ltr.feature.SolrFeature",
"params" : {
"fq": ["{!terms f=category}book"]
}
}
What could be the reason that causes this, and how can we resolve this issue?
The reason could be weights param missing on *model.json you created using the above feature json file. So, please make sure you have included weight param for each feature defined on your feature json file.
Your *model.json file should look something like below,
For more info please refer Solr 7.4 documentation.
Thanks.