Skip to content

Commit

Permalink
meta: cleanup some printf usage
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Jan 14, 2025
1 parent 2c54d75 commit 160a982
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 45 deletions.
2 changes: 0 additions & 2 deletions internal/indices/indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ func ProcessSliceFn[T any](in []T, groups int, f func(T)) {
indices := New(len(in), groups)
numGroups := len(indices) - 1 // Number of actual chunks

// fmt.Printf("in=%d groups=%v indices=%v numGroups=%v\n", len(in), groups, indices, numGroups)

// Use WaitGroup for synchronization
var wg sync.WaitGroup
wg.Add(numGroups)
Expand Down
7 changes: 0 additions & 7 deletions internal/search/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,17 @@ func (s *service) performSearch(ctx context.Context, query search.Entity[search.

results := items.Items()
var out []search.SearchedEntity[search.Value]
// fmt.Printf("results=%d ", len(results))

for _, res := range results {
if res.Value.SourceID == "" || res.Weight <= 0.001 {
continue
}

// fmt.Printf("res: %#v\n", res)

// fmt.Println("append")
out = append(out, search.SearchedEntity[search.Value]{
Entity: res.Value,
Match: res.Weight,
})
}
// fmt.Printf("out: %d\n", len(out))

// fmt.Printf("result mapping took: %v\n", time.Since(start))

return out, nil
}
Expand Down
1 change: 0 additions & 1 deletion internal/stringscore/jaro_winkler.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ func JaroWinklerWithFavoritism(indexedTerm, query string, favoritism float64) fl
var scores []float64
for i := range indexedWords {
max, term := maxMatch(indexedWords[i], i, queryWords)
//fmt.Printf("%s maxMatch %s %f\n", indexedWords[i], term, max)
if max >= 1.0 {
// If the query is longer than our indexed term (and EITHER are longer than most names)
// we want to reduce the maximum weight proportionally by the term difference, which
Expand Down
19 changes: 7 additions & 12 deletions pkg/csl_eu/download_eu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,28 @@ package csl_eu

import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"testing"

"github.com/moov-io/base/log"
"github.com/stretchr/testify/require"
)

func TestEUDownload(t *testing.T) {
if testing.Short() {
return
}

file, err := DownloadEU(context.Background(), log.NewNopLogger(), "")
if err != nil {
t.Fatal(err)
}
fmt.Println("file in test: ", file)
if len(file) == 0 {
t.Fatal("no EU CSL file")
}
files, err := DownloadEU(context.Background(), log.NewNopLogger(), "")
require.NoError(t, err)
require.Len(t, files, 1)

for fn := range file {
if !strings.EqualFold("eu_csl.csv", filepath.Base(fn)) {
t.Errorf("unknown file %s", file)
for filename := range files {
if !strings.EqualFold("eu_csl.csv", filepath.Base(filename)) {
t.Errorf("unknown file %s", filename)
}
}
}
Expand Down
35 changes: 12 additions & 23 deletions pkg/csl_uk/download_uk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package csl_uk

import (
"context"
"fmt"
"io"
"os"
"path/filepath"
Expand All @@ -22,18 +21,13 @@ func TestCSLDownload(t *testing.T) {
return
}

file, err := DownloadCSL(context.Background(), log.NewNopLogger(), "")
if err != nil {
t.Fatal(err)
}
fmt.Println("file in test: ", file)
if len(file) == 0 {
t.Fatal("no UK CSL file")
}
files, err := DownloadCSL(context.Background(), log.NewNopLogger(), "")
require.NoError(t, err)
require.Len(t, files, 1)

for fn := range file {
if !strings.EqualFold("ConList.csv", filepath.Base(fn)) {
t.Errorf("unknown file %s", file)
for filename := range files {
if !strings.EqualFold("ConList.csv", filepath.Base(filename)) {
t.Errorf("unknown file %s", filename)
}
}
}
Expand Down Expand Up @@ -96,18 +90,13 @@ func TestUKSanctionsListDownload(t *testing.T) {
}

logger := log.NewTestLogger()
file, err := DownloadSanctionsList(context.Background(), logger, "")
if err != nil {
t.Fatal(err)
}
fmt.Println("file in test: ", file)
if len(file) == 0 {
t.Fatal("no UK Sanctions List file")
}
files, err := DownloadSanctionsList(context.Background(), logger, "")
require.NoError(t, err)
require.Len(t, files, 1)

for fn := range file {
if !strings.EqualFold("UK_Sanctions_List.ods", filepath.Base(fn)) {
t.Errorf("unknown file %s", file)
for filename := range files {
if !strings.EqualFold("UK_Sanctions_List.ods", filepath.Base(filename)) {
t.Errorf("unknown file %s", filename)
}
}
}
Expand Down

0 comments on commit 160a982

Please sign in to comment.