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 e553cab commit b6c63cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ts/packages/knowPro/src/dataFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface IConversation<TMeta extends IKnowledgeSource = any> {
semanticRefs: SemanticRef[] | undefined;
semanticRefIndex?: ITermToSemanticRefIndex | undefined;
propertyToSemanticRefIndex: IPropertyToSemanticRefIndex | undefined;
relatedTermsIndex?: ITermToRelatedTermsIndex | undefined;
termToRelatedTermsIndex?: ITermToRelatedTermsIndex | undefined;
timestampIndex?: ITimestampToTextRangeIndex | undefined;
}

Expand Down
4 changes: 3 additions & 1 deletion ts/packages/knowPro/src/relatedTermsIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ export async function resolveRelatedTerms(
relatedTermsIndex: ITermToRelatedTermsIndex,
searchTerms: SearchTerm[],
): Promise<void> {
// Resolve any hardcoded mappings
for (const searchTerm of searchTerms) {
const termText = searchTerm.term.text;
// Resolve any specific term to related term mappings
if (!searchTerm.relatedTerms || searchTerm.relatedTerms.length === 0) {
searchTerm.relatedTerms = relatedTermsIndex.lookupTerm(termText);
}
// If no hard-coded mappings, lookup any fuzzy related terms
// Future: do this in batch
if (!searchTerm.relatedTerms || searchTerm.relatedTerms.length === 0) {
searchTerm.relatedTerms =
await relatedTermsIndex.lookupTermFuzzy(termText);
Expand Down
4 changes: 2 additions & 2 deletions ts/packages/knowPro/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ class SearchQueryBuilder {
}

private async prepareSearchTerms(searchTerms: SearchTerm[]): Promise<void> {
if (this.conversation.relatedTermsIndex) {
if (this.conversation.termToRelatedTermsIndex) {
await resolveRelatedTerms(
this.conversation.relatedTermsIndex,
this.conversation.termToRelatedTermsIndex,
searchTerms,
);
}
Expand Down

0 comments on commit b6c63cc

Please sign in to comment.