mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 01:46:02 +00:00
handle camelCase in tokenizer
This commit is contained in:
@@ -90,6 +90,10 @@ export function tokenizeBySearchFilter(text: string, filter: string): { text: st
|
|||||||
for (const item of res) {
|
for (const item of res) {
|
||||||
const indexes = [];
|
const indexes = [];
|
||||||
for (const char of token) {
|
for (const char of token) {
|
||||||
|
if (indexes.length == 0 && char == item.text[0]?.toUpperCase()) {
|
||||||
|
// handle first letter of camelcase
|
||||||
|
indexes.push(0);
|
||||||
|
} else {
|
||||||
const index = item.text.indexOf(char, indexes.length > 0 ? indexes[indexes.length - 1] + 1 : 0);
|
const index = item.text.indexOf(char, indexes.length > 0 ? indexes[indexes.length - 1] + 1 : 0);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
indexes.push(-1);
|
indexes.push(-1);
|
||||||
@@ -97,6 +101,7 @@ export function tokenizeBySearchFilter(text: string, filter: string): { text: st
|
|||||||
indexes.push(index);
|
indexes.push(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (indexes.some(x => x < 0)) {
|
if (indexes.some(x => x < 0)) {
|
||||||
nextres.push(item);
|
nextres.push(item);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user