Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 976c4d0980 | |||
| eda652994d |
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-10-29 - 1.5.1 - fix(scriptindex)
|
||||||
|
Improve script search: use ObjectSorter with weighted results prioritizing slug and name
|
||||||
|
|
||||||
|
- Replaced smartfuzzy.FuzzyMatcher with smartfuzzy.ObjectSorter for multi-field fuzzy searching
|
||||||
|
- Search now runs across slug, name, and description fields
|
||||||
|
- Added weighting so slug matches are prioritized, name matches receive a medium boost
|
||||||
|
- Search returns ordered script objects based on adjusted score
|
||||||
|
|
||||||
## 2025-10-29 - 1.5.0 - feat(scripts)
|
## 2025-10-29 - 1.5.0 - feat(scripts)
|
||||||
Add fuzzy search and type filtering for community scripts; improve scripts CLI output and cache handling
|
Add fuzzy search and type filtering for community scripts; improve scripts CLI output and cache handling
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/moxytool",
|
"name": "@serve.zone/moxytool",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"exports": "./mod.ts",
|
"exports": "./mod.ts",
|
||||||
"nodeModulesDir": "auto",
|
"nodeModulesDir": "auto",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/moxytool",
|
"name": "@serve.zone/moxytool",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "Proxmox administration tool for vGPU setup, VM management, and cluster configuration",
|
"description": "Proxmox administration tool for vGPU setup, VM management, and cluster configuration",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"proxmox",
|
"proxmox",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/moxytool',
|
name: '@serve.zone/moxytool',
|
||||||
version: '1.5.0',
|
version: '1.5.1',
|
||||||
description: 'Proxmox administration tool for vGPU setup, VM management, and cluster configuration'
|
description: 'Proxmox administration tool for vGPU setup, VM management, and cluster configuration'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,29 +272,35 @@ export class ScriptIndex {
|
|||||||
scripts = scripts.filter((script) => script.type === typeFilter);
|
scripts = scripts.filter((script) => script.type === typeFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use smartfuzzy for ranking
|
// Use ObjectSorter for fuzzy searching across multiple fields
|
||||||
const fuzzyMatcher = new plugins.smartfuzzy.FuzzyMatcher();
|
const sorter = new plugins.smartfuzzy.ObjectSorter(scripts);
|
||||||
|
|
||||||
const scoredResults = scripts.map((script) => {
|
// Search across slug, name, and description
|
||||||
// Calculate match scores for each field
|
const results = sorter.sort(query, ['slug', 'name', 'description']);
|
||||||
const nameScore = script.name ? fuzzyMatcher.match(query, script.name) : 0;
|
|
||||||
const slugScore = script.slug ? fuzzyMatcher.match(query, script.slug) : 0;
|
|
||||||
const descScore = script.description ? fuzzyMatcher.match(query, script.description) : 0;
|
|
||||||
|
|
||||||
// Prioritize: slug > name > description
|
// Post-process to weight results by which field matched
|
||||||
const totalScore = slugScore * 3 + nameScore * 2 + descScore;
|
const weightedResults = results.map((result) => {
|
||||||
|
let weight = 1;
|
||||||
|
|
||||||
|
// Boost score if match was in slug (highest priority)
|
||||||
|
if (result.matches?.some((m) => m.key === 'slug')) {
|
||||||
|
weight = 3;
|
||||||
|
}
|
||||||
|
// Boost if match was in name (medium priority)
|
||||||
|
else if (result.matches?.some((m) => m.key === 'name')) {
|
||||||
|
weight = 2;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
script,
|
...result,
|
||||||
score: totalScore,
|
adjustedScore: (result.score || 0) / weight,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter out non-matches and sort by score
|
// Sort by adjusted score and return just the script objects
|
||||||
return scoredResults
|
return weightedResults
|
||||||
.filter((result) => result.score > 0)
|
.sort((a, b) => (a.adjustedScore || 0) - (b.adjustedScore || 0))
|
||||||
.sort((a, b) => b.score - a.score)
|
.map((result) => result.item);
|
||||||
.map((result) => result.script);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user