From 6cfc8c86868123d33221e79efc454500bc3c5ef0 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Fri, 14 Oct 2022 14:43:32 +0200 Subject: [PATCH 1/2] fix space indexing Signed-off-by: jkoberg --- services/search/pkg/engine/bleve.go | 6 +----- services/search/pkg/search/provider.go | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/search/pkg/engine/bleve.go b/services/search/pkg/engine/bleve.go index b896722d870..822c8b62129 100644 --- a/services/search/pkg/engine/bleve.go +++ b/services/search/pkg/engine/bleve.go @@ -167,11 +167,7 @@ func (b *Bleve) Search(_ context.Context, sir *searchService.SearchIndexRequest) return nil, err } - pID, err := storagespace.ParseID(getValue[string](hit.Fields, "ParentID")) - if err != nil { - return nil, err - } - + pID, _ := storagespace.ParseID(getValue[string](hit.Fields, "ParentID")) match := &searchMessage.Match{ Score: float32(hit.Score), Entity: &searchMessage.Entity{ diff --git a/services/search/pkg/search/provider.go b/services/search/pkg/search/provider.go index 9b60c1b3fa3..4552a44f05b 100644 --- a/services/search/pkg/search/provider.go +++ b/services/search/pkg/search/provider.go @@ -265,9 +265,14 @@ func (p *Provider) IndexSpace(ctx context.Context, req *searchsvc.IndexSpaceRequ p.logger.Error().Err(err).Msg("error extracting content") } + var pid string + if info.ParentId != nil { + pid = storagespace.FormatResourceID(*info.ParentId) + } r := engine.Resource{ ID: storagespace.FormatResourceID(*info.Id), RootID: storagespace.FormatResourceID(*ref.ResourceId), + ParentID: pid, Path: ref.Path, Type: uint64(info.Type), Document: doc, From 26f852ae5ca964c2d135f0890670459b598c49be Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Fri, 14 Oct 2022 15:53:07 +0200 Subject: [PATCH 2/2] fix indexing --- services/search/pkg/search/provider.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/search/pkg/search/provider.go b/services/search/pkg/search/provider.go index 4552a44f05b..157364036b5 100644 --- a/services/search/pkg/search/provider.go +++ b/services/search/pkg/search/provider.go @@ -270,8 +270,12 @@ func (p *Provider) IndexSpace(ctx context.Context, req *searchsvc.IndexSpaceRequ pid = storagespace.FormatResourceID(*info.ParentId) } r := engine.Resource{ - ID: storagespace.FormatResourceID(*info.Id), - RootID: storagespace.FormatResourceID(*ref.ResourceId), + ID: storagespace.FormatResourceID(*info.Id), + RootID: storagespace.FormatResourceID(provider.ResourceId{ + StorageId: info.Id.StorageId, + OpaqueId: info.Id.SpaceId, + SpaceId: info.Id.SpaceId, + }), ParentID: pid, Path: ref.Path, Type: uint64(info.Type),