Closed peterdm closed 7 years ago
I was similarly puzzled, but when I run the query below, I get two docs with a score of 1.0, not the field value I expected. When documents are missing a feature, they get a vaue of 0.0. So all 3 would take the left split
GET /rando/_search
{
"query": {
"script": {
"script": {
"lang": "expression",
"inline": "doc['lucky_number']"
}
}
}
}
Using a function_score_query
with a field value factor works:
GET /rando/_search
{
"query": {
"ltr": {
"model": {
"stored": "testmodel"
},
"features": [
{
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"field_value_factor": {
"field": "lucky_number"
}
}
]
}
}
]
}
},
"script_fields": {
"1": {
"script": {
"lang": "expression",
"inline": "doc['lucky_number']"
}
}
},
"_source": true
}
Awesome. Better RTFD prevailed! Thanks.
To reproduce create the following index:
Load the following model (with a
lucky_number
split threshold of 0.99 )And run the scoring query
As you'd expect fortune-1 takes the left-split, and fortune-2 and 3 take the right-split.
Now reload the same model but modify the
lucky_number
split threshold to be 2.5And re-run the scoring query above.
(Expectation fortune-1 and fortune 2 take the left split, while fortune-3 takes the right split)
However: All three end up taking the left split despite the fact that
3.3 > 2.5
(This behavior seems to indicate that RankLib is receiving
min(script_computed_value, 1.0)
... as opposed to the explicit script_computed_value)Note: I validated this standalone with RankLib directly and the test as structured above was successful.