Skip to content

Commit 9b644ed

Browse files
authored
Merge pull request #152 from devsapp/fix/sls-fulltext-query-syntax
fix: use quoted full-text search instead of field-specific SLS query …
2 parents 2b98125 + 9e365ff commit 9b644ed

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

__tests__/ut/commands/logs_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ describe('Logs', () => {
565565
);
566566

567567
expect(result).toBe(
568-
'__topic__:"FCLogs:test-function" and baseQuery and searchTerm and qualifier: "LATEST" and instanceID: "inst-456" and requestId: "req-123"',
568+
'__topic__:"FCLogs:test-function" and baseQuery and searchTerm and "LATEST" and "inst-456" and "req-123"',
569569
);
570570
});
571571

@@ -592,7 +592,7 @@ describe('Logs', () => {
592592
);
593593

594594
expect(result).toBe(
595-
'(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function") and instanceID: "inst-456"',
595+
'(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function") and "inst-456"',
596596
);
597597
});
598598

@@ -609,7 +609,7 @@ describe('Logs', () => {
609609
expect(result).toBe('__topic__:"FCLogs:test-function"');
610610
});
611611

612-
it('should use field-specific syntax for qualifier', () => {
612+
it('should use quoted full-text search for qualifier', () => {
613613
const result = (logs as any).getSlsQuery(
614614
null,
615615
null,
@@ -619,7 +619,7 @@ describe('Logs', () => {
619619
'__topic__:"FCLogs:test-function"',
620620
);
621621

622-
expect(result).toBe('__topic__:"FCLogs:test-function" and qualifier: "LATEST"');
622+
expect(result).toBe('__topic__:"FCLogs:test-function" and "LATEST"');
623623
});
624624
});
625625

publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Type: Component
33
Name: fc3
44
Provider:
55
- 阿里云
6-
Version: 0.1.19
6+
Version: 0.1.20
77
Description: 阿里云函数计算全生命周期管理
88
HomePage: https://github.com/devsapp/fc3
99
Organization: 阿里云函数计算(FC)

src/subCommands/logs/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export default class Logs {
297297
// }
298298

299299
if (match) {
300-
l = replaceAll(l, match, `\x1B[43m${match}\x1B[0m`);
300+
l = replaceAll(l, match, `\x1B[7m${match}\x1B[0m`);
301301
}
302302

303303
console.log(l);
@@ -477,17 +477,17 @@ export default class Logs {
477477
}
478478

479479
if (!_.isNil(qualifier)) {
480-
q = hasValue ? `${q} and qualifier: "${qualifier}"` : `qualifier: "${qualifier}"`;
480+
q = hasValue ? `${q} and "${qualifier}"` : `"${qualifier}"`;
481481
hasValue = true;
482482
}
483483

484484
if (!_.isNil(instanceId)) {
485-
q = hasValue ? `${q} and instanceID: "${instanceId}"` : `instanceID: "${instanceId}"`;
485+
q = hasValue ? `${q} and "${instanceId}"` : `"${instanceId}"`;
486486
hasValue = true;
487487
}
488488

489489
if (!_.isNil(requestId)) {
490-
q = hasValue ? `${q} and requestId: "${requestId}"` : `requestId: "${requestId}"`;
490+
q = hasValue ? `${q} and "${requestId}"` : `"${requestId}"`;
491491
}
492492

493493
return q;

0 commit comments

Comments
 (0)