From b984c1ad01b14e774b70a51ea17fb4eb3c5bc1c8 Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Fri, 1 Sep 2023 09:15:10 +0200 Subject: [PATCH] fix: acceptance tests to include path resource --- services/search/pkg/engine/bleve.go | 6 +++--- services/search/pkg/engine/bleve_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/search/pkg/engine/bleve.go b/services/search/pkg/engine/bleve.go index 1de9a7a6a8..6ffed52cdf 100644 --- a/services/search/pkg/engine/bleve.go +++ b/services/search/pkg/engine/bleve.go @@ -172,10 +172,10 @@ func (b *Bleve) Search(_ context.Context, sir *searchService.SearchIndexRequest) if sir.Ref != nil { hitPath := strings.TrimSuffix(getFieldValue[string](hit.Fields, "Path"), "/") - sirPath := utils.MakeRelativePath(sir.Ref.Path) - isMountPoint := hitPath == sirPath + requestedPath := utils.MakeRelativePath(sir.Ref.Path) + isPathRoot := hitPath == requestedPath - if !isMountPoint && sirPath != "." && !strings.HasPrefix(hitPath, sirPath+"/") { + if !isPathRoot && requestedPath != "." && !strings.HasPrefix(hitPath, requestedPath+"/") { totalMatches-- continue } diff --git a/services/search/pkg/engine/bleve_test.go b/services/search/pkg/engine/bleve_test.go index 6c54d5468e..f5692c6f40 100644 --- a/services/search/pkg/engine/bleve_test.go +++ b/services/search/pkg/engine/bleve_test.go @@ -340,7 +340,7 @@ var _ = Describe("Bleve", func() { It("search *doc* in a subfolder", func() { res, err := doSearch(rootResource.ID, "Name:*doc*", "./doc") Expect(err).ToNot(HaveOccurred()) - Expect(res.TotalMatches).To(Equal(int32(1))) + Expect(res.TotalMatches).To(Equal(int32(2))) }) It("search *file* in a root", func() { res, err := doSearch(rootResource.ID, "Name:*file*", "")