Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better availability scoring #20

Open
dokterbob opened this issue Jul 4, 2021 · 0 comments
Open

Better availability scoring #20

dokterbob opened this issue Jul 4, 2021 · 0 comments

Comments

@dokterbob
Copy link
Member

dokterbob commented Jul 4, 2021

{
	"fields": [
		"metadata.title",
		"first-seen",
		"last-seen"
	],
	"query": {
		"bool": {
			"must": {
				"query_string": {
					"query": "banner"
				}
			},
			"should": {
				"distance_feature": {
					"field": "last-seen",
					"pivot": "30d",
					"origin": "now/h",
					"boost": 3.0
				}
			}
		}
	},
	"script_fields": {
		"availability": {
			"script": {
				"lang": "expression",
				"source": "doc['last-seen'].empty ? default : exp((ln(decay)/(scale*(doc['last-seen']-doc['first-seen'] + scale_offset)))*(now - doc['first-seen'].value))",
				"params": {
					"default": 0.0,
					"scale_offset": 21600000,
					"now": 1625393744150,
					"scale": 0.4,
					"decay": 0.9
				}
			}
		}
	},
	"rescore": {
		"window_size": 50,
		"query": {
			"rescore_query": {
				"script_score": {
					"query": {
						"match_all": {}
					},
					"script": {
						"lang": "expression",
						"source": "doc['last-seen'].empty ? default : exp((ln(decay)/(scale*(doc['last-seen']-doc['first-seen'] + scale_offset)))*(now - doc['first-seen'].value))",
						"params": {
							"default": 0.0,
							"scale_offset": 21600000,
							"now": 1625393744150,
							"scale": 0.4,
							"decay": 0.9
						}
					}
				}
			},
			"query_weight": 1.0,
			"rescore_query_weight": 15
		}
	}
}
@dokterbob dokterbob changed the title Better availability scoring/information Better availability scoring Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant