Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CascadingRadium committed Nov 22, 2024
1 parent 32c67af commit 784f45b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions mapping/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,7 @@ func (im *IndexMappingImpl) SynonymSourceForPath(path string) string {

return ""
}

func (im *IndexMappingImpl) SynonymCount() int {
return len(im.SynonymSources)
}
7 changes: 4 additions & 3 deletions search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3749,7 +3749,7 @@ func TestAutoFuzzy(t *testing.T) {
}
}

func TestSynonymSearch(t *testing.T) {
func TestSynonymTermReader(t *testing.T) {
tmpIndexPath := createTmpIndexPath(t)
defer cleanupTmpIndexPath(t, tmpIndexPath)

Expand All @@ -3759,12 +3759,13 @@ func TestSynonymSearch(t *testing.T) {

synonymAnalyzer := "simple"

imap := mapping.NewIndexMapping()
textField := mapping.NewTextFieldMapping()
textField.Analyzer = simple.Name
textField.SynonymSource = synonymSourceName

imap := mapping.NewIndexMapping()
imap.DefaultMapping.AddFieldMappingsAt("text", textField)
imap.AddSynonymSource(synonymSourceName, synonymCollection, synonymAnalyzer)

err := imap.Validate()
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 784f45b

Please sign in to comment.