MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / saveSearchPreference

Function saveSearchPreference

src/renderer/src/stores/commandDataStore.ts:481–501  ·  view source on GitHub ↗
(
    query: string,
    command: { path: string; featureCode?: string; name: string }
  )

Source from the content-addressed store, hash-verified

479
480 // 保存搜索偏好(搜索词 -> 选中的指令)
481 async function saveSearchPreference(
482 query: string,
483 command: { path: string; featureCode?: string; name: string }
484 ): Promise<void> {
485 const key = query.trim().toLowerCase()
486 if (!key) return
487
488 searchPreference.value[key] = {
489 path: command.path,
490 featureCode: command.featureCode,
491 name: command.name
492 }
493 try {
494 await window.ztools.dbPut(
495 'search-preference',
496 JSON.parse(JSON.stringify(searchPreference.value))
497 )
498 } catch (error) {
499 console.error('保存搜索偏好失败:', error)
500 }
501 }
502
503 // 从数据库加载所有数据(仅在初始化时调用一次)
504 async function initializeData(): Promise<void> {

Callers

nothing calls this directly

Calls 2

stringifyMethod · 0.80
dbPutMethod · 0.45

Tested by

no test coverage detected