Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed not retrieving results for Uppercase accented words using lowercase non-accented counterparts #101

Merged
merged 1 commit into from
Sep 8, 2024
Merged
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
12 changes: 6 additions & 6 deletions internal/index/bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

// Version identifies the mapping used for indexing. Any changes in the mapping requires an increase
// of version, to signal that a new index needs to be created.
const Version = "v2"
const Version = "v3"

// Metadata fields
var (
Expand All @@ -33,11 +33,11 @@ var (
)

var noStopWordsFilters = map[string][]string{
es.AnalyzerName: {es.NormalizeName, lowercase.Name, es.LightStemmerName},
en.AnalyzerName: {en.PossessiveName, lowercase.Name, porter.Name},
de.AnalyzerName: {de.NormalizeName, lowercase.Name, de.LightStemmerName},
fr.AnalyzerName: {fr.ElisionName, lowercase.Name, fr.LightStemmerName},
it.AnalyzerName: {it.ElisionName, lowercase.Name, it.LightStemmerName},
es.AnalyzerName: {lowercase.Name, es.NormalizeName, es.LightStemmerName},
en.AnalyzerName: {lowercase.Name, en.PossessiveName, porter.Name},
de.AnalyzerName: {lowercase.Name, de.NormalizeName, de.LightStemmerName},
fr.AnalyzerName: {lowercase.Name, fr.ElisionName, fr.LightStemmerName},
it.AnalyzerName: {lowercase.Name, it.ElisionName, it.LightStemmerName},
pt.AnalyzerName: {lowercase.Name, pt.LightStemmerName},
}

Expand Down
29 changes: 29 additions & 0 deletions internal/index/bleve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,34 @@ func testCases() []testCase {
},
),
},
{
"Test spanish stemmer returning accented word while using unaccented word in search",
"lib/book9.epub",
metadata.Metadata{
Title: "Últimos días en Colditz",
Authors: []string{"Patrick R. Reid"},
Description: "Just test metadata",
Language: "es",
Subjects: []string{"History", "WWII"},
},
"ultimos",
result.NewPaginated[[]index.Document](
model.ResultsPerPage,
1,
1,
[]index.Document{
{
ID: "book9.epub",
Slug: "patrick-r-reid-ultimos-dias-en-colditz",
Metadata: metadata.Metadata{
Title: "Últimos días en Colditz",
Authors: []string{"Patrick R. Reid"},
Description: "Just test metadata",
Subjects: []string{"History", "WWII"},
},
},
},
),
},
}
}