Page MenuHomePhabricator
Paste P10309

maximum of sigmoid of two separate morelikethis queries
ActivePublic

Authored by EBernhardson on Tue, Feb 4, 9:00 PM.
{
"_source": [
"namespace_text",
"title"
],
"size": 3,
"query": {
"bool": {
"must": [
{
"dis_max": {
"queries": [
{
"function_score": {
"boost_mode": "replace",
"query": {
"more_like_this": {
"min_doc_freq": 2,
"max_doc_freq": null,
"max_query_terms": 25,
"min_term_freq": 2,
"min_word_length": 0,
"max_word_length": 0,
"minimum_should_match": "30%",
"fields": [
"text"
],
"like": [
{
"_id": "752"
}
]
}
},
"functions": [
{
"script_score": {
"script": {
"params": {
"a": 5,
"m": 10
},
"source": "Math.pow(_score, params.a) / (Math.pow(_score, params.a) + Math.pow(params.m, params.a))"
}
}
}
]
}
},
{
"function_score": {
"boost_mode": "replace",
"query": {
"more_like_this": {
"min_doc_freq": 2,
"max_doc_freq": null,
"max_query_terms": 25,
"min_term_freq": 2,
"min_word_length": 0,
"max_word_length": 0,
"minimum_should_match": "30%",
"fields": [
"text"
],
"like": [
{
"_id": "22939"
}
]
}
},
"functions": [
{
"script_score": {
"script": {
"params": {
"a": 5,
"m": 10
},
"source": "Math.pow(_score, params.a) / (Math.pow(_score, params.a) + Math.pow(params.m, params.a))"
}
}
}
]
}
}
]
}
}
],
"filter": [
{
"terms": {
"namespace": [
0
]
}
}
]
}
}
}