Knowledge search counts a text match by how many of the question's words it holds
The best text match took the whole text weight, however little of the
question it matched: one everyday word ("most") put the remote-work page
above the travel one for "the most I can spend on a hotel". Now a chunk
gains the weight in proportion to the share of the question's words it
holds, counted once whatever their case.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bc5ee9f3aa
commit
2c7b682587
2 files changed
+40
-20
No files matched your search
@@ -378,10 +378,16 @@ func TestPostgresMeaningOutweighsSharedWords(t *testing.T) {
|
||||
if len(hits) != 1 || hits[0].Document != "babalik.md" {
|
||||
t.Errorf("best hit %+v", hits)
|
||||
}
|
||||
// And a question that holds a passage's exact words still finds it,
|
||||
// with nothing embedded at all (the model down).
|
||||
hits, err = s.SearchChunks(ctx, KBSearch{OrgID: "org1", Collections: []KBCollection{c}, Text: "babalık hakkı", K: 1})
|
||||
if err != nil || len(hits) != 1 || hits[0].Document != "babalik.md" || hits[0].Score != textWeight {
|
||||
t.Errorf("text alone: %+v %v", hits, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrQueryMatchesAnyWord(t *testing.T) {
|
||||
if got := orQuery("Yıllık izin kaç gün? İzin & 'x' -- a"); got != "Yıllık | izin | gün | İzin" {
|
||||
if got := orQuery("Yıllık izin kaç gün? İzin & 'x' -- a"); got != "Yıllık | izin | gün" {
|
||||
t.Errorf("orQuery gave %q", got)
|
||||
}
|
||||
// Words every passage has are no evidence of anything.
|
||||
|
||||
Reference in new issue
Block a user