fix exact match bug,
This commit is contained in:
@@ -219,7 +219,7 @@ async function getInstancesFragment () {
|
|||||||
async function refreshInstances () {
|
async function refreshInstances () {
|
||||||
let instances = await getInstancesFragment();
|
let instances = await getInstancesFragment();
|
||||||
if (instances.status !== 200) {
|
if (instances.status !== 200) {
|
||||||
alert("Error fetching instances.");
|
alert(`Error fetching instances: ${instances.status} ${instances.error != undefined ? instances.error : ""}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
instances = instances.data;
|
instances = instances.data;
|
||||||
@@ -253,9 +253,9 @@ function sortInstances () {
|
|||||||
if (substrInc) {
|
if (substrInc) {
|
||||||
const substrStartIndex = item.indexOf(query);
|
const substrStartIndex = item.indexOf(query);
|
||||||
const queryLength = query.length;
|
const queryLength = query.length;
|
||||||
const remaining = item.length - substrInc - queryLength;
|
const remaining = item.length - substrInc - queryLength + 1;
|
||||||
const alignment = `${"X".repeat(substrStartIndex)}${"M".repeat(queryLength)}${"X".repeat(remaining)}`;
|
const alignment = `${"X".repeat(substrStartIndex)}${"M".repeat(queryLength)}${"X".repeat(remaining)}`;
|
||||||
return { score: 1, alignment };
|
return { score: -1, alignment };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const alignment = `${"X".repeat(item.length)}`;
|
const alignment = `${"X".repeat(item.length)}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user