Bleve Scoring for Prefix query

80 views
Skip to first unread message

Indira CT

unread,
Sep 25, 2022, 4:50:42 PM9/25/22
to bleve

Hi all,
I'm trying to understand Bleve's scoring better. This is the example that I'm trying with,
Type:
type Data struct {
Name1    string
Name2 string

 For a search term "Friends", a Search Result where Name1 is "Friends" has a score of 1.1915563679773256 whereas the search result with Name2 "Feather Friends" has a score of 7.332569694529527, the queries and the document mappings I'm using are the same. The explanation for the result "Friends"(Name1) has a queryWeight clause within, but the second result doesn't have it. Can you please help me understand this? I've attached bleve score explanations for the two search terms. Thanks in advance

Doc mapping
DocMapping:= bleve.NewDocumentMapping()
indexedKeyWordFieldMapping := bleve.NewTextFieldMapping()
DocMapping.AddFieldMappingsAt("Name1", indexedKeyWordFieldMapping)
DocMapping.AddFieldMappingsAt("Name2", indexedKeyWordFieldMapping)

Query
query:= bleve.NewPrefixQuery(searchTerm)
query.SetField(“Name1")
queries = append(queries, query)
query:= bleve.NewDisjunctionQuery(queries)
-----------------
query := bleve.NewPrefixQuery(searchTerm)
query.SetField(“Name2")
queries = append(queries, query)
query := bleve.NewDisjunctionQuery(queries)

Feather_friends
Friends
Reply all
Reply to author
Forward
0 new messages