fix: acceptance tests to include path resource

This commit is contained in:
Florian Schade
2023-09-01 09:15:10 +02:00
committed by jkoberg
parent af9556f8f1
commit a0f2adedb5
2 changed files with 4 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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*", "")