From 20ad217ed24c94eb60527c0f5ffffefcdef33e2f Mon Sep 17 00:00:00 2001 From: the_tree Date: Wed, 1 Jul 2026 21:30:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Update=20plugin=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2Neo=20v1.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Initialize Everything file finder - Refactor Finder components - Add richer file previews - Add Markdown and code previews - Add PDF preview support - Fix PDF local file loading - Refactor Finder module structure - Centralize Finder persistence - Polish Finder UI styling - Implement local file icon caching - Polish Finder preview layout - Add file tree preview support - Add image preview copy action - Document project guidance - Add file copy menu action - Clean dist addon build output - Refine addon preview support - Tune Finder result pagination - Move category management to settings - Highlight Finder search matches - Stabilize image preview layout - Refine Finder enter handling - Centralize Finder shared state - Polish Finder UI behavior - Add bundled Everything management - Rename dist cleanup script - Refine bundled Everything shutdown - Add manual release workflow - Trigger release workflow on changes - Package dist contents in release - Limit large tar archive previews - Add shared addon argument parsing - Replace WMIC lookup with PowerShell CIM - Fix tail text preview decoding - Update README and test typings - Add platform info - Refactor Finder preview flow - Copy preview images as files - Add code preview line numbers - Add floating preview zoom - Improve match path search results - fix unexpected cleaning sub input when UI initializing --- plugins/local-search-neo/src/App.vue | 42 ++++++++++++++----- .../src/Finder/composables/useFinderSearch.ts | 21 ++++++++-- .../src/Finder/composables/useSubInput.ts | 11 +---- .../src/Finder/core/finderLogic.test.ts | 25 +++++++++++ .../src/Finder/core/finderLogic.ts | 21 ++++++++++ plugins/local-search-neo/src/Finder/index.vue | 2 - 6 files changed, 95 insertions(+), 27 deletions(-) diff --git a/plugins/local-search-neo/src/App.vue b/plugins/local-search-neo/src/App.vue index 3595ec7e..74cf200c 100644 --- a/plugins/local-search-neo/src/App.vue +++ b/plugins/local-search-neo/src/App.vue @@ -3,7 +3,11 @@ import { onMounted } from "vue"; import Finder from "./Finder/index.vue"; import { useFinderEnterAction } from "./Finder/composables/useFinderEnterAction"; import { getFileIconDataUrl, warmUpFileIconCache } from "./Finder/core/fileIconCache"; -import { DEFAULT_CATEGORIES, buildEverythingQuery } from "./Finder/core/finderLogic"; +import { + DEFAULT_CATEGORIES, + buildEverythingQuery, + mergeResultsByMatchPathPriority, +} from "./Finder/core/finderLogic"; import { useFinderCategories } from "./Finder/composables/useFinderCategories"; import { usePersistStorage } from "./Finder/composables/usePersistStorage"; import { useSubInput } from "./Finder/composables/useSubInput"; @@ -47,23 +51,39 @@ onMounted(() => { try { if (!window.services.everything.isAvailable()) return []; if (window.services.everything.getStartupStatus().state !== "ready") return []; - const result = window.services.everything.query( + const nameResult = window.services.everything.query( everythingQuery, MAIN_PUSH_RESULT_LIMIT, "modified-desc", - matchPathEnabled.value, + false, ); - const items: MainPushSearchResult[] = result.items.map((item) => ({ - title: item.path ?? getParentPath(item.fullPath), - text: item.name, - icon: window.ztools.getFileIcon(item.fullPath), - fullPath: item.fullPath, - })); + const matchPathResult = matchPathEnabled.value + ? window.services.everything.query( + everythingQuery, + MAIN_PUSH_RESULT_LIMIT, + "modified-desc", + true, + ) + : undefined; - if (result.total > MAIN_PUSH_RESULT_LIMIT) { + const resultItems = matchPathResult + ? mergeResultsByMatchPathPriority(nameResult.items, matchPathResult.items) + : nameResult.items; + const total = matchPathResult?.total ?? nameResult.total; + + const items: MainPushSearchResult[] = resultItems + .slice(0, MAIN_PUSH_RESULT_LIMIT) + .map((item) => ({ + title: item.path ?? getParentPath(item.fullPath), + text: item.name, + icon: window.ztools.getFileIcon(item.fullPath), + fullPath: item.fullPath, + })); + + if (total > MAIN_PUSH_RESULT_LIMIT) { items.pop(); items.push({ - text: `共有${result.total}个结果,查看更多...`, + text: `共有${total}个结果,查看更多...`, }); } diff --git a/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts b/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts index 34e8981c..fdbd490c 100644 --- a/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts +++ b/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts @@ -3,6 +3,7 @@ import { getNextSelectedPath, getNextVisibleCount, getRestoredSelectedPath, + mergeResultsByMatchPathPriority, type FinderResult, type FinderSortMode, } from "../core/finderLogic"; @@ -76,14 +77,26 @@ export function useFinderSearch({ visibleCount.value = pageSize; try { - const result = window.services.everything.query( + const nameResult = window.services.everything.query( everythingQuery, maxResults, currentSortMode, - currentMatchPathEnabled, + false, ); - results.value = result.items; - everythingTotal.value = result.total; + + if (currentMatchPathEnabled) { + const matchPathResult = window.services.everything.query( + everythingQuery, + maxResults, + currentSortMode, + true, + ); + results.value = mergeResultsByMatchPathPriority(nameResult.items, matchPathResult.items); + everythingTotal.value = matchPathResult.total; + } else { + results.value = nameResult.items; + everythingTotal.value = nameResult.total; + } updateResultStatus(); restoreSelection(options); } catch (error: unknown) { diff --git a/plugins/local-search-neo/src/Finder/composables/useSubInput.ts b/plugins/local-search-neo/src/Finder/composables/useSubInput.ts index 2dd350d8..c1f28f1e 100644 --- a/plugins/local-search-neo/src/Finder/composables/useSubInput.ts +++ b/plugins/local-search-neo/src/Finder/composables/useSubInput.ts @@ -22,7 +22,6 @@ export function useSubInput({ onInput, placeholder = "全盘搜索" }: UseSubInp if (onInput) { inputListeners.delete(onInput); } - disposeSubInput(); }); function bindSubInput() { @@ -46,6 +45,7 @@ export function useSubInput({ onInput, placeholder = "全盘搜索" }: UseSubInp subInputReady = true; } + /** 当非用户操作需要修改子输入框的值, 不触发重新搜索 */ function syncSubInputValue() { if (!subInputReady) return; programmaticInputValue = queryText.value; @@ -56,19 +56,10 @@ export function useSubInput({ onInput, placeholder = "全盘搜索" }: UseSubInp window.ztools.subInputFocus(); } - function disposeSubInput() { - if (!subInputReady) return; - - window.ztools.removeSubInput(); - subInputReady = false; - programmaticInputValue = undefined; - } - return { bindSubInput, syncSubInputValue, focusSubInput, - disposeSubInput, }; } diff --git a/plugins/local-search-neo/src/Finder/core/finderLogic.test.ts b/plugins/local-search-neo/src/Finder/core/finderLogic.test.ts index a953b5a4..63b0571f 100644 --- a/plugins/local-search-neo/src/Finder/core/finderLogic.test.ts +++ b/plugins/local-search-neo/src/Finder/core/finderLogic.test.ts @@ -17,6 +17,7 @@ import { isPdfPreviewCandidate, isTextPreviewCandidate, isVideoPreviewCandidate, + mergeResultsByMatchPathPriority, type FinderCategory, type FinderResult, } from "./finderLogic"; @@ -105,6 +106,30 @@ test("getRestoredSelectedPath keeps existing visible selection or picks sorted f assert.equal(getRestoredSelectedPath([], "D:\\missing.txt"), ""); }); +test("mergeResultsByMatchPathPriority keeps name matches first and removes duplicates", () => { + const nameResults: FinderResult[] = [ + { name: "name-a.txt", path: "C:\\demo", fullPath: "C:\\demo\\name-a.txt" }, + { name: "shared.txt", path: "C:\\demo", fullPath: "C:\\demo\\shared.txt" }, + { name: "name-b.txt", path: "D:\\demo", fullPath: "D:\\demo\\name-b.txt" }, + ]; + const matchPathResults: FinderResult[] = [ + { name: "shared.txt", path: "C:\\demo", fullPath: "c:\\demo\\shared.txt" }, + { name: "path-a.txt", path: "C:\\demo", fullPath: "C:\\demo\\path-a.txt" }, + { name: "path-b.txt", path: "D:\\demo", fullPath: "D:\\demo\\path-b.txt" }, + ]; + + assert.deepEqual( + mergeResultsByMatchPathPriority(nameResults, matchPathResults).map((item) => item.fullPath), + [ + "C:\\demo\\name-a.txt", + "C:\\demo\\shared.txt", + "D:\\demo\\name-b.txt", + "C:\\demo\\path-a.txt", + "D:\\demo\\path-b.txt", + ], + ); +}); + test("preview candidate helpers detect supported file types", () => { assert.equal(isTextPreviewCandidate({ name: "main.log", size: 1024 }), true); assert.equal(isTextPreviewCandidate({ name: "notes.md", size: 1024 }), true); diff --git a/plugins/local-search-neo/src/Finder/core/finderLogic.ts b/plugins/local-search-neo/src/Finder/core/finderLogic.ts index a8bed7f1..33c955bc 100644 --- a/plugins/local-search-neo/src/Finder/core/finderLogic.ts +++ b/plugins/local-search-neo/src/Finder/core/finderLogic.ts @@ -168,6 +168,23 @@ export function getRestoredSelectedPath(results: FinderResult[], currentPath: st return results[0]?.fullPath ?? ""; } +export function mergeResultsByMatchPathPriority< + T extends Pick, +>(nameResults: T[], matchPathResults: T[]): T[] { + const seen = new Set(); + const merged: T[] = []; + + for (const item of [...nameResults, ...matchPathResults]) { + const key = getResultDedupeKey(item); + if (seen.has(key)) continue; + + seen.add(key); + merged.push(item); + } + + return merged; +} + export function isImagePreviewCandidate( file: Pick, ): boolean { @@ -265,6 +282,10 @@ export function formatBytes(bytes?: number): string { return `${formatNumber(value)} ${units[unitIndex]}`; } +function getResultDedupeKey(item: Pick): string { + return (item.fullPath || `${item.path ?? ""}\\${item.name}`).toLowerCase(); +} + function normalizeCategoryRule(rule: string): string { const trimmed = rule.trim(); if (!trimmed) return ""; diff --git a/plugins/local-search-neo/src/Finder/index.vue b/plugins/local-search-neo/src/Finder/index.vue index ed172f76..25d7eb70 100644 --- a/plugins/local-search-neo/src/Finder/index.vue +++ b/plugins/local-search-neo/src/Finder/index.vue @@ -124,8 +124,6 @@ watch( onMounted(() => { bindSubInput(); - syncSubInputValue(); - startEverythingStatusPolling(); void ensureEverythingReady(); window.ztools.onPluginOut(closeTransientState); }); From 8cb1e66abd63ad56d4afdfeaeab80aa099569da1 Mon Sep 17 00:00:00 2001 From: the_tree Date: Wed, 1 Jul 2026 21:36:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Update=20plugin=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2Neo=20v1.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Initialize Everything file finder - Refactor Finder components - Add richer file previews - Add Markdown and code previews - Add PDF preview support - Fix PDF local file loading - Refactor Finder module structure - Centralize Finder persistence - Polish Finder UI styling - Implement local file icon caching - Polish Finder preview layout - Add file tree preview support - Add image preview copy action - Document project guidance - Add file copy menu action - Clean dist addon build output - Refine addon preview support - Tune Finder result pagination - Move category management to settings - Highlight Finder search matches - Stabilize image preview layout - Refine Finder enter handling - Centralize Finder shared state - Polish Finder UI behavior - Add bundled Everything management - Rename dist cleanup script - Refine bundled Everything shutdown - Add manual release workflow - Trigger release workflow on changes - Package dist contents in release - Limit large tar archive previews - Add shared addon argument parsing - Replace WMIC lookup with PowerShell CIM - Fix tail text preview decoding - Update README and test typings - Add platform info - Refactor Finder preview flow - Copy preview images as files - Add code preview line numbers - Add floating preview zoom - Improve match path search results - fix unexpected cleaning sub input when UI initializing - update version --- plugins/local-search-neo/public/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/local-search-neo/public/plugin.json b/plugins/local-search-neo/public/plugin.json index a00af079..88ccf6c7 100644 --- a/plugins/local-search-neo/public/plugin.json +++ b/plugins/local-search-neo/public/plugin.json @@ -4,7 +4,7 @@ "author": "the_tree", "title": "本地搜索Neo", "description": "借助 Everything 来进行文件搜索", - "version": "1.0.0", + "version": "1.0.1", "main": "index.html", "preload": "preload/services.js", "logo": "logo.png", From b9f44d4a9d8321bf6babc500a21ff51dfa4ea0e2 Mon Sep 17 00:00:00 2001 From: the_tree Date: Wed, 1 Jul 2026 21:43:00 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Update=20plugin=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2Neo=20v1.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Initialize Everything file finder - Refactor Finder components - Add richer file previews - Add Markdown and code previews - Add PDF preview support - Fix PDF local file loading - Refactor Finder module structure - Centralize Finder persistence - Polish Finder UI styling - Implement local file icon caching - Polish Finder preview layout - Add file tree preview support - Add image preview copy action - Document project guidance - Add file copy menu action - Clean dist addon build output - Refine addon preview support - Tune Finder result pagination - Move category management to settings - Highlight Finder search matches - Stabilize image preview layout - Refine Finder enter handling - Centralize Finder shared state - Polish Finder UI behavior - Add bundled Everything management - Rename dist cleanup script - Refine bundled Everything shutdown - Add manual release workflow - Trigger release workflow on changes - Package dist contents in release - Limit large tar archive previews - Add shared addon argument parsing - Replace WMIC lookup with PowerShell CIM - Fix tail text preview decoding - Update README and test typings - Add platform info - Refactor Finder preview flow - Copy preview images as files - Add code preview line numbers - Add floating preview zoom - Improve match path search results - fix unexpected cleaning sub input when UI initializing - update version - update package.json --- plugins/local-search-neo/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/local-search-neo/package.json b/plugins/local-search-neo/package.json index 25245ef7..5e4d7670 100644 --- a/plugins/local-search-neo/package.json +++ b/plugins/local-search-neo/package.json @@ -1,6 +1,6 @@ { "name": "local-search-neo", - "version": "1.0.0", + "version": "1.0.1", "description": "借助 Everything 来进行文件搜索", "type": "module", "scripts": { From 72bfe5f9f03b5a3b417c3d7fffcf1ae792e1a0c9 Mon Sep 17 00:00:00 2001 From: the_tree Date: Wed, 1 Jul 2026 21:52:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Update=20plugin=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2Neo=20v1.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Initialize Everything file finder - Refactor Finder components - Add richer file previews - Add Markdown and code previews - Add PDF preview support - Fix PDF local file loading - Refactor Finder module structure - Centralize Finder persistence - Polish Finder UI styling - Implement local file icon caching - Polish Finder preview layout - Add file tree preview support - Add image preview copy action - Document project guidance - Add file copy menu action - Clean dist addon build output - Refine addon preview support - Tune Finder result pagination - Move category management to settings - Highlight Finder search matches - Stabilize image preview layout - Refine Finder enter handling - Centralize Finder shared state - Polish Finder UI behavior - Add bundled Everything management - Rename dist cleanup script - Refine bundled Everything shutdown - Add manual release workflow - Trigger release workflow on changes - Package dist contents in release - Limit large tar archive previews - Add shared addon argument parsing - Replace WMIC lookup with PowerShell CIM - Fix tail text preview decoding - Update README and test typings - Add platform info - Refactor Finder preview flow - Copy preview images as files - Add code preview line numbers - Add floating preview zoom - Improve match path search results - fix unexpected cleaning sub input when UI initializing - update version - update package.json - Fix match path review issues --- plugins/local-search-neo/src/App.vue | 4 ++-- .../src/Finder/composables/useFinderSearch.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/local-search-neo/src/App.vue b/plugins/local-search-neo/src/App.vue index 74cf200c..484a1963 100644 --- a/plugins/local-search-neo/src/App.vue +++ b/plugins/local-search-neo/src/App.vue @@ -74,9 +74,9 @@ onMounted(() => { const items: MainPushSearchResult[] = resultItems .slice(0, MAIN_PUSH_RESULT_LIMIT) .map((item) => ({ - title: item.path ?? getParentPath(item.fullPath), + title: item.path ?? (item.fullPath ? getParentPath(item.fullPath) : ""), text: item.name, - icon: window.ztools.getFileIcon(item.fullPath), + icon: item.fullPath ? window.ztools.getFileIcon(item.fullPath) : undefined, fullPath: item.fullPath, })); diff --git a/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts b/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts index fdbd490c..560f51ef 100644 --- a/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts +++ b/plugins/local-search-neo/src/Finder/composables/useFinderSearch.ts @@ -91,7 +91,10 @@ export function useFinderSearch({ currentSortMode, true, ); - results.value = mergeResultsByMatchPathPriority(nameResult.items, matchPathResult.items); + results.value = mergeResultsByMatchPathPriority( + nameResult.items, + matchPathResult.items, + ).slice(0, maxResults); everythingTotal.value = matchPathResult.total; } else { results.value = nameResult.items;