scorescript

package
v0.0.0-...-9c67b44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LangMultipliers = map[string]float64{
		"Norsk (bokmål)":  1.5,
		"Norsk (nynorsk)": 1.5,
		"Norsk":           1.5,
		"Engelsk":         1.4,
		"Svensk":          1.3,
		"Dansk":           1.3,
		"Nordsamisk":      1.2,
		"Tysk":            1.2,
		"Fransk":          1.2,
		"Sørsamisk":       1.1,
		"Lulesamisk":      1.1,
		"Spansk":          1.1,
		"Italiensk":       1.1,
	}
)

Functions

This section is empty.

Types

type ScoreScriptParams

type ScoreScriptParams struct {
	AgeGain   float64 // justeringsfaktor for hvor mye ferskhet har å si
	AgeScale  float64 // antall dager ferskhetsfaktor spenner over (før den blir 1.0 og ikke har noen effekt)
	ItemsGain float64 // justeringsfaktor for hvor mye antall eksemplarer har å si
	Now       int64   // sekunder siden epoch
}

func Get

func Get(isMatchAll bool, scoreByMediaType bool, urlParams url.Values) (scoreFunc *elastic.ScriptFunction, scriptParams ScoreScriptParams)

Choose a scoring function based on whether it's a match all query (stjernesøk) or not. Favors books in certain languages (Norwegian > English > Swedish > ...) over other media types regardless, and if it's a match all query it will also favor newer publications over older ones.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL