From 06631b3d3fe8e8bb8c5a36a331fbd01e1969c730 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Tue, 10 Oct 2023 20:25:25 -0700 Subject: [PATCH] search/searcher: fix dropped test errors --- search/searcher/search_boolean_test.go | 3 +++ search/searcher/search_conjunction_test.go | 6 ++++-- search/searcher/search_term_range_test.go | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/search/searcher/search_boolean_test.go b/search/searcher/search_boolean_test.go index f1a748f08..d457d208a 100644 --- a/search/searcher/search_boolean_test.go +++ b/search/searcher/search_boolean_test.go @@ -205,6 +205,9 @@ func TestBooleanSearch(t *testing.T) { t.Fatal(err) } conjunctionSearcher7, err := NewConjunctionSearcher(nil, twoDocIndexReader, []search.Searcher{martyTermSearcher7, booleanSearcher7}, explainTrue) + if err != nil { + t.Fatal(err) + } // test 7 beerTermSearcher8, err := NewTermSearcher(nil, twoDocIndexReader, "beer", "desc", 1.0, explainTrue) diff --git a/search/searcher/search_conjunction_test.go b/search/searcher/search_conjunction_test.go index ab82e3666..3582b976a 100644 --- a/search/searcher/search_conjunction_test.go +++ b/search/searcher/search_conjunction_test.go @@ -378,7 +378,7 @@ func testScorchCompositeSearchOptimizationsHelper( next, err := cs.Next(ctx) i := 0 - for err == nil && next != nil { + for next != nil { docID, err := indexReader.ExternalID(next.IndexInternalID) if err != nil { t.Fatal(err) @@ -391,8 +391,10 @@ func testScorchCompositeSearchOptimizationsHelper( t.Errorf("missing %s", string(docID)) } } - next, err = cs.Next(ctx) + if err != nil { + t.Fatalf("error iterating searcher: %v", err) + } i++ } diff --git a/search/searcher/search_term_range_test.go b/search/searcher/search_term_range_test.go index 3bbd43185..927b782b9 100644 --- a/search/searcher/search_term_range_test.go +++ b/search/searcher/search_term_range_test.go @@ -244,7 +244,7 @@ func TestTermRangeSearchTooManyTerms(t *testing.T) { } next, err := searcher.Next(ctx) i := 0 - for err == nil && next != nil { + for next != nil { extId, err := scorchReader.ExternalID(next.IndexInternalID) if err != nil { t.Fatal(err) @@ -252,11 +252,11 @@ func TestTermRangeSearchTooManyTerms(t *testing.T) { got = append(got, extId) ctx.DocumentMatchPool.Put(next) next, err = searcher.Next(ctx) + if err != nil { + t.Fatalf("error iterating searcher: %v", err) + } i++ } - if err != nil { - t.Fatalf("error iterating searcher: %v", err) - } err = searcher.Close() if err != nil { t.Fatal(err)