Fix: linter complaints
This commit is contained in:
@@ -47,7 +47,6 @@ func isStopWord(word string) bool {
|
||||
func detectPhrases(query string) []string {
|
||||
words := strings.Fields(strings.ToLower(query))
|
||||
var phrases []string
|
||||
|
||||
for i := 0; i < len(words)-1; i++ {
|
||||
word1 := strings.Trim(words[i], ".,!?;:'\"()[]{}")
|
||||
word2 := strings.Trim(words[i+1], ".,!?;:'\"()[]{}")
|
||||
@@ -70,7 +69,6 @@ func detectPhrases(query string) []string {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return phrases
|
||||
}
|
||||
|
||||
@@ -122,7 +120,6 @@ func areSlugsAdjacent(slug1, slug2 string) bool {
|
||||
if prefix1 != prefix2 {
|
||||
return false
|
||||
}
|
||||
|
||||
batch1, chunk1, ok1 := parseSlugIndices(slug1)
|
||||
batch2, chunk2, ok2 := parseSlugIndices(slug2)
|
||||
if !ok1 || !ok2 {
|
||||
@@ -843,7 +840,6 @@ func (r *RAG) GenerateQueryVariations(query string) []string {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return variations
|
||||
}
|
||||
|
||||
|
||||
@@ -297,7 +297,6 @@ relative term as it was still a few kilometers away.
|
||||
|
||||
The clan house was made of brick and conformed to an older style of architecture. Nearly everyone knew about this mansion and its clock tower. It stood tall over the neighboring mansions and rumor had it that you could see the whole capital from the top. It
|
||||
spoke to this clan’s renown and history that they were able to get away with building something that dwarfed the mansions of the nobility.`
|
||||
|
||||
chunks := []*models.VectorRow{
|
||||
{
|
||||
Slug: "kjv_bible.epub_1786_0",
|
||||
|
||||
@@ -41,7 +41,6 @@ func TestRealBiblicalQuery(t *testing.T) {
|
||||
t.Fatalf("failed to create RAG instance: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { rag.Destroy() })
|
||||
|
||||
query := "bald prophet and two she bears"
|
||||
results, err := rag.Search(query, 30)
|
||||
if err != nil {
|
||||
@@ -95,7 +94,6 @@ func TestRealQueryVariations(t *testing.T) {
|
||||
t.Fatalf("failed to create RAG instance: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { rag.Destroy() })
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
query string
|
||||
|
||||
@@ -30,7 +30,6 @@ func TestDetectPhrases(t *testing.T) {
|
||||
expect: []string{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
got := detectPhrases(tt.query)
|
||||
if len(got) != len(tt.expect) {
|
||||
@@ -73,7 +72,6 @@ func TestCountPhraseMatches(t *testing.T) {
|
||||
expect: 2, // "she bears" and "bald prophet"
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
got := countPhraseMatches(tt.text, tt.query)
|
||||
if got != tt.expect {
|
||||
@@ -119,7 +117,6 @@ func TestAreSlugsAdjacent(t *testing.T) {
|
||||
expect: true, // sequential batches with same chunk index are adjacent
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
got := areSlugsAdjacent(tt.slug1, tt.slug2)
|
||||
if got != tt.expect {
|
||||
@@ -141,7 +138,6 @@ func TestParseSlugIndices(t *testing.T) {
|
||||
{"file_abc_def", 0, 0, false},
|
||||
{"file_123_456_extra", 456, 0, false}, // regex matches last two numbers
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
batch, chunk, ok := parseSlugIndices(tt.slug)
|
||||
if ok != tt.wantOk {
|
||||
|
||||
Reference in New Issue
Block a user