Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions server/vespa/schemas/chat_message.sd
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ schema chat_message {
inputs {
query(e) tensor<bfloat16>(v[DIMS])
query(alpha) double
query(slackBoost) double
}

constants {
Expand All @@ -158,13 +159,19 @@ schema chat_message {
}
}

function is_slack() {
expression: if(attribute(app) == "slack", 1, 0)
}

function combined_nativeRank() {
expression {
(
nativeRank(text) +
nativeRank(username) +
nativeRank(name)
) / if(matchedFieldCount == 0, 1, matchedFieldCount)
(
nativeRank(text) +
nativeRank(username) +
nativeRank(name)
) / if(matchedFieldCount == 0, 1, matchedFieldCount)
) * if(is_slack == 1, query(slackBoost), 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a detailed comment explaining why this boost is necessary?

}
}

Expand Down Expand Up @@ -196,6 +203,7 @@ schema chat_message {
nativeRank(text)
nativeRank(username)
nativeRank(name)
is_slack
}
}

Expand Down Expand Up @@ -248,6 +256,7 @@ schema chat_message {
nativeRank(text)
nativeRank(username)
nativeRank(name)
is_slack
}
}

Expand Down
8 changes: 6 additions & 2 deletions server/vespa/schemas/event.sd
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ schema event {
query(e) tensor<bfloat16>(v[DIMS])
query(alpha) double
query(recency_decay_rate) double
query(eventBoost) double
}

constants {
Expand Down Expand Up @@ -195,6 +196,9 @@ schema event {
(META_FIELDS_DECAY * (bm25(attachmentFilenames) + bm25(attendeesNames)))
}
}
function is_event() {
expression: if(attribute(app) == "google-calendar", 1, 0)
}

function matchedFieldCount() {
expression {
Expand All @@ -205,15 +209,15 @@ schema event {

function combined_nativeRank() {
expression {
(
( (
(
nativeRank(name) +
nativeRank(description) +
nativeRank(url)
) / if(matchedFieldCount == 0, 1, matchedFieldCount)
)
+
(META_FIELDS_DECAY * (nativeRank(attachmentFilenames) + nativeRank(attendeesNames)))
(META_FIELDS_DECAY * (nativeRank(attachmentFilenames) + nativeRank(attendeesNames))) ) * if(is_event == 1, query(eventBoost), 1)
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion server/vespa/schemas/file.sd
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ schema file {
query(e) tensor<bfloat16>(v[DIMS]) # Query embedding
query(alpha) double # Alpha parameter for hybrid weight
query(recency_decay_rate) double
query(fileBoost) double
}

constants {
Expand Down Expand Up @@ -183,9 +184,12 @@ schema file {
matches(title) + matches(chunks)
}
}
function is_file() {
expression: if(attribute(app) == "google-drive", 1, 0)
}

function combined_nativeRank() {
expression: (nativeRank(title) + nativeRank(chunks)) / if(matchedFieldCount == 0, 1, matchedFieldCount)
expression: ((nativeRank(title) + nativeRank(chunks)) / if(matchedFieldCount == 0, 1, matchedFieldCount))* if(is_file == 1, query(fileBoost), 1)
}

function chunk_scores() {
Expand Down
6 changes: 5 additions & 1 deletion server/vespa/schemas/mail.sd
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ schema mail {
query(e) tensor<bfloat16>(v[DIMS]) # Query embedding
query(alpha) double # Alpha parameter for hybrid weight
query(recency_decay_rate) double
query(mailBoost) double
}

constants {
Expand Down Expand Up @@ -171,6 +172,9 @@ schema mail {

function combined_bm25() {
expression: bm25(subject) + bm25(chunks)
}
function is_mail() {
expression: if(attribute(app) == "gmail", 1, 0)
}

function matchedFieldCount() {
Expand All @@ -192,7 +196,7 @@ schema mail {
expression {
if(query(is_intent_search) == 1.0,
simplePeopleRank,
((nativeRank(subject) + nativeRank(chunks) + peopleRank) / if(matchedFieldCount == 0, 1, matchedFieldCount))
((nativeRank(subject) + nativeRank(chunks) + peopleRank) / if(matchedFieldCount == 0, 1, matchedFieldCount))* if(is_mail == 1, query(mailBoost), 1)
)
}
}
Expand Down