Reputation: 924
I am new to AWS cloudsearch, There is relevance score (_score) which is computed automatically based on the search terms occurrences..
My question is that Can I increase my relevance score(_score) by specific amount based on specific key value..
Example:
Lets say cloudsearch returns following two documents
fields: {
{
fullname: "Daniel Wildt",
active: "T",
_score: "82"
}
{
fullname: "Robert",
active: "F",
_score: "84"
}
}
I want First document (Daniel Wildt) to be higher... It means by active = T aws should add something to the score
Upvotes: 0
Views: 761
Reputation: 2681
Unfortunately you can't use a custom rank
directly because that's only available for sort-enabled numeric fields (int, double, date).
Here are a couple alternative options
active
field, it will become dominant enough to be functionally equivalent to the the sort
operator. That is, you can just add sort=active desc
to your query to get the T results before F&expr.myrank=_score+active&sort=myrank
active:'T'
to your query, which would potentially exclude results where active=F, and then use field weights to adjust the impact of this portion of the query: q.options={fields:['active^0.5']}
. This will require some tuningUpvotes: 1