Documentation ¶
Index ¶
- Constants
- Variables
- func AddCollectionsSearchRequests(mss *elastic.MultiSearchService, query Query, sortBy string, from int, ...)
- func AddContentUnitsSearchRequests(mss *elastic.MultiSearchService, query Query, sortBy string, from int, ...)
- func CompareResults(base int, exp int) int
- func ParseUidExpectation(e string) (string, error)
- func SuggestionHasOptions(ss elastic.SearchSuggest) bool
- type ESEngine
- type Engine
- type EvalQuery
- type EvalResult
- type EvalResults
- type Expectation
- type MdbUid
- type Query
- type SearchClick
- type SearchLog
- type SearchLogger
- func (searchLogger *SearchLogger) GetAllQueries() ([]SearchLog, error)
- func (searchLogger *SearchLogger) LogClick(mdbUid string, index string, indexType string, rank int, searchId string) error
- func (searchLogger *SearchLogger) LogSearch(query Query, sortBy string, from int, size int, searchId string, ...) error
- func (searchLogger *SearchLogger) LogSearchError(query Query, sortBy string, from int, size int, searchId string, ...) error
Constants ¶
const ( SQ_SERVER_ERROR = iota SQ_NO_EXPECTATION = iota SQ_UNKNOWN = iota SQ_REGULAR = iota SQ_GOOD = iota )
Search quality enum. Order important, the lower (higher integer) the better.
const ( CR_WIN = iota CR_LOSS = iota CR_SAME = iota CR_NO_EXPECTATION = iota CR_ERROR = iota )
Compare results classification.
const ( ET_CONTENT_UNITS = iota ET_COLLECTIONS = iota )
Variables ¶
var COMPARE_RESULTS_NAME = map[int]string{ CR_WIN: "Win", CR_LOSS: "Loss", CR_SAME: "Same", CR_ERROR: "Error", }
var EXPECTATION_HIT_TYPE = map[int]string{ ET_CONTENT_UNITS: "content_units", ET_COLLECTIONS: "collections", }
var EXPECTATION_URL_PATH = map[int]string{ ET_CONTENT_UNITS: "cu", ET_COLLECTIONS: "c", }
var SEARCH_QUALITY_NAME = map[int]string{ SQ_GOOD: "Good", SQ_REGULAR: "Regular", SQ_UNKNOWN: "Unknown", SQ_NO_EXPECTATION: "NoExpectation", SQ_SERVER_ERROR: "ServerError", }
Functions ¶
func AddCollectionsSearchRequests ¶ added in v0.6.9
func AddContentUnitsSearchRequests ¶ added in v0.6.9
func CompareResults ¶ added in v0.8.0
Returns compare results classification constant.
func ParseUidExpectation ¶ added in v0.7.8
func SuggestionHasOptions ¶ added in v0.7.1
func SuggestionHasOptions(ss elastic.SearchSuggest) bool
Types ¶
type ESEngine ¶
type ESEngine struct {
// contains filtered or unexported fields
}
func NewESEngine ¶
type EvalQuery ¶ added in v0.7.8
type EvalQuery struct { Language string `json:"language"` Query string `json:"query"` Weight uint64 `json:"weight,omitempty"` Bucket string `json:"bucket,omitempty"` Expectations []Expectation `json:"expectations"` Comment string `json:"comment,omitempty"` }
func ReadEvalSet ¶ added in v0.7.8
type EvalResult ¶ added in v0.7.8
type EvalResult struct { SearchQuality []int `json:"search_quality"` Rank []int `json:"rank"` // contains filtered or unexported fields }
func EvaluateQuery ¶ added in v0.7.8
func EvaluateQuery(q EvalQuery, serverUrl string) EvalResult
type EvalResults ¶ added in v0.7.8
type Expectation ¶ added in v0.8.0
func ParseExpectation ¶ added in v0.8.0
func ParseExpectation(e string) (Expectation, error)
Parses expectation described by result URL and converts to type (collections or content_units) and uid. Examples: https://archive.kbb1.com/he/programs/cu/AsNLozeK ==> (content_units, AsNLozeK) https://archive.kbb1.com/he/programs/c/fLWpcUjQ ==> (collections , fLWpcUjQ) Later we will need to add filters and landing pages, Examples: https://archive.kbb1.com/he/lessons?source=bs_L2jMWyce_kB3eD83I ==> (lessons, nil, source=bs_L2jMWyce_kB3eD83I) https://archive.kbb1.com/he/programs?topic=g3ml0jum_1nyptSIo_RWqjxgkj ==> (programs, nil, topic=g3ml0jum_1nyptSIo_RWqjxgkj) All events sub pages and years: https://archive.kbb1.com/he/events/meals https://archive.kbb1.com/he/events/friends-gatherings https://archive.kbb1.com/he/events?year=2013
type SearchClick ¶ added in v0.8.0
type SearchLog ¶ added in v0.7.7
type SearchLog struct { Created time.Time `json:"created",omitempty` Query Query `json:"query"` Results interface{} `json:"results,omitempty"` Error interface{} `json:"error,omitempty"` SortBy string `json:"sort_by,omitempty"` From uint64 `json:"from"` Size uint64 `json:"size,omitempty"` SearchId string `json:"search_id"` }
type SearchLogger ¶ added in v0.7.7
type SearchLogger struct {
// contains filtered or unexported fields
}
func MakeSearchLogger ¶ added in v0.7.7
func MakeSearchLogger(esc *elastic.Client) *SearchLogger
func (*SearchLogger) GetAllQueries ¶ added in v0.7.8
func (searchLogger *SearchLogger) GetAllQueries() ([]SearchLog, error)