Skip to content

Commit

Permalink
Do not use prefix queries which gets slow with big indexes
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Schade <[email protected]>
  • Loading branch information
aduffeck and fschade committed May 10, 2023
1 parent 1c0e318 commit 8ffa596
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions services/search/pkg/engine/bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ func (b *Bleve) Search(_ context.Context, sir *searchService.SearchIndexRequest)
},
),
},
&query.PrefixQuery{
Prefix: utils.MakeRelativePath(path.Join(sir.Ref.Path, "/")),
FieldVal: "Path",
},
)
}

Expand All @@ -160,6 +156,10 @@ func (b *Bleve) Search(_ context.Context, sir *searchService.SearchIndexRequest)

matches := make([]*searchMessage.Match, 0, len(res.Hits))
for _, hit := range res.Hits {
if sir.Ref != nil && !strings.HasPrefix(getValue[string](hit.Fields, "Path"), utils.MakeRelativePath(path.Join(sir.Ref.Path, "/"))) {
continue
}

rootID, err := storagespace.ParseID(getValue[string](hit.Fields, "RootID"))
if err != nil {
return nil, err
Expand Down

0 comments on commit 8ffa596

Please sign in to comment.