Skip to content

Commit

Permalink
fix(kb.gbapp): Quotes to prevent question indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 31, 2021
1 parent f2e0d76 commit e9a9a47
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
7 changes: 7 additions & 0 deletions DATABASE-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@ GO
ALTER TABLE dbo.GuaribasUser ADD
agentSystemId nvarchar(255) NULL,
GO

# 2.0.115

ALTER TABLE dbo.GuaribasQuestion ADD
skipIndex bit NULL
GO

10 changes: 10 additions & 0 deletions packages/azuredeployer.gbapp/services/AzureDeployerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ export class AzureDeployerService implements IGBInstallationDeployer {
facetable: false,
key: false
},
{
name: 'skipIndex',
type: 'Edm.Boolean',
searchable: false,
filterable: true,
retrievable: true,
sortable: false,
facetable: false,
key: false
},
{
name: 'packageId',
type: 'Edm.Int32',
Expand Down
3 changes: 3 additions & 0 deletions packages/kb.gbapp/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export class GuaribasQuestion extends Model<GuaribasQuestion> {
@Column
public keywords: string;

@Column
public skipIndex: boolean;

@Column(DataType.STRING(512))
public from: string;

Expand Down
7 changes: 4 additions & 3 deletions packages/kb.gbapp/services/KBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export class KBService implements IGBKBService {
.use(instance.searchIndex)
.buildQuery()
.filter(f => f.eq('instanceId', instance.instanceId))
.filter(f => f.eq('skipIndex', false))
.search(query)
.top(1)
.executeQuery();
Expand All @@ -276,7 +277,7 @@ export class KBService implements IGBKBService {
GBLog.info(
`SEARCH WILL BE USED with score: ${returnedScore} > required (searchScore): ${searchScore}`
);


return { answer: value, questionId: values[0].questionId };
} else {
Expand Down Expand Up @@ -467,9 +468,9 @@ export class KBService implements IGBKBService {
subject2: subject2,
subject3: subject3,
subject4: subject4,
content: question,
content: question.replace(/['"]+/g, ''),
instanceId: instanceId,

skipIndex: (question.charAt(0) === "\""),
packageId: packageId
};
questions.push(question1);
Expand Down

0 comments on commit e9a9a47

Please sign in to comment.