From a0f2adedb522f8d76eaa72d433f7e5af2c1e4dc1 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 58d29036b1..358c96f9d9 100644 --- a/services/search/pkg/engine/bleve.go +++ b/services/search/pkg/engine/bleve.go @@ -177,10 +177,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 85a623d3a6..c1ec06f0e9 100644 --- a/services/search/pkg/engine/bleve_test.go +++ b/services/search/pkg/engine/bleve_test.go @@ -341,7 +341,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*", "")