-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmapping_terrier.go
More file actions
41 lines (32 loc) · 1.07 KB
/
mapping_terrier.go
File metadata and controls
41 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//+build windows
package boogie
import "github.com/hscells/groove/stats"
// NewTerrierStatisticsSource attempts to create a terrier statistics source.
func NewTerrierStatisticsSource(config map[string]interface{}) *stats.TerrierStatisticsSource {
var propsFile string
field := "text"
if pf, ok := config["properties"]; ok {
propsFile = pf.(string)
}
if f, ok := config["field"]; ok {
field = f.(string)
}
var searchOptions stats.SearchOptions
if search, ok := config["search"].(map[string]interface{}); ok {
if size, ok := search["size"].(int); ok {
searchOptions.Size = size
} else {
searchOptions.Size = 1000
}
if runName, ok := search["run_name"].(string); ok {
searchOptions.RunName = runName
} else {
searchOptions.RunName = "run"
}
}
params := map[string]float64{"k": 10, "lambda": 0.5}
if p, ok := config["params"].(map[string]float64); ok {
params = p
}
return stats.NewTerrierStatisticsSource(stats.TerrierParameters(params), stats.TerrierField(field), stats.TerrierPropertiesPath(propsFile), stats.TerrierSearchOptions(searchOptions))
}