Skip to content

Commit

Permalink
Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
umeshma committed Feb 4, 2025
1 parent 7828ddf commit cf7c7b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions ts/packages/knowPro/src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,24 +344,21 @@ export class SelectTopNExpr<T extends MatchAccumulator> extends QueryOpExpr<T> {

export type QueryTermExpr = MatchSearchTermExpr | MatchQualifiedSearchTermExpr;

export class MatchTermsExpr extends QueryOpExpr<SemanticRefAccumulator> {
export class GetSearchMatchesExpr extends QueryOpExpr<SemanticRefAccumulator> {
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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ts/packages/knowPro/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SearchQueryBuilder {
matchTermsExpr.push(...this.compilePropertyTerms(propertyTerms));
}
let selectExpr: q.IQueryOpExpr<SemanticRefAccumulator> =
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) {
Expand Down

0 comments on commit cf7c7b0

Please sign in to comment.