diff --git a/ts/packages/knowPro/src/query.ts b/ts/packages/knowPro/src/query.ts index ab349e2a6..73e2c2d2d 100644 --- a/ts/packages/knowPro/src/query.ts +++ b/ts/packages/knowPro/src/query.ts @@ -344,24 +344,21 @@ export class SelectTopNExpr extends QueryOpExpr { export type QueryTermExpr = MatchSearchTermExpr | MatchQualifiedSearchTermExpr; -export class MatchTermsExpr extends QueryOpExpr { +export class GetSearchMatchesExpr extends QueryOpExpr { constructor(public searchTermExpressions: QueryTermExpr[]) { super(); } public override eval(context: QueryEvalContext): SemanticRefAccumulator { - const matchAccumulator: SemanticRefAccumulator = - new SemanticRefAccumulator(); - const index = context.conversation.semanticRefIndex; - if (index !== undefined) { - for (const matchExpr of this.searchTermExpressions) { - const matches = matchExpr.eval(context); - if (matches && matches.size > 0) { - matchAccumulator.addUnion(matches); - } + const allMatches: SemanticRefAccumulator = new SemanticRefAccumulator(); + + for (const matchExpr of this.searchTermExpressions) { + const termMatches = matchExpr.eval(context); + if (termMatches && termMatches.size > 0) { + allMatches.addUnion(termMatches); } } - return matchAccumulator; + return allMatches; } } diff --git a/ts/packages/knowPro/src/search.ts b/ts/packages/knowPro/src/search.ts index 3580789d4..a114affd0 100644 --- a/ts/packages/knowPro/src/search.ts +++ b/ts/packages/knowPro/src/search.ts @@ -127,7 +127,7 @@ class SearchQueryBuilder { matchTermsExpr.push(...this.compilePropertyTerms(propertyTerms)); } let selectExpr: q.IQueryOpExpr = - new q.MatchTermsExpr(matchTermsExpr); + new q.GetSearchMatchesExpr(matchTermsExpr); // Always apply "tag match" scope... all text ranges that matched tags.. are in scope selectExpr = this.compileScope(selectExpr, filter?.dateRange); if (filter !== undefined) {