Global search (Cmd/Ctrl+J) never sorts results by relevance

オープン 初心者向け
#6,107 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@hamidzr がすでに取り組んでいます。

2026年11月23日 から。

  • #6108 @hamidzr による — オープン
  • #6109 @hamidzr による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nextjs, react, typescript
領域
frontend, search

調査の方向性

apps/dokploy/package.json から始めます。ここでは cmdk が ^0.2.1 に固定されています。次に components/ui/command.tsx を読みます。issue によると、これはすでに cmdk 1.x の wrapper と一致しています。^1.1.1 に上げ、dashboard を実行し、billing という名前の service で Cmd/Ctrl+J を使って再現します。ranking がまだおかしい場合は、components/dashboard/search-command.tsx で任意の value/keywords 変更を適用し、92 行目と 121 行目の周辺にあるネストされた CommandList wrapper を削除します。完了とは、完全な名前一致が最初に並び、Enter でそれが開くことです。

索引モデルが issue の本文から書いたものです。

説明

bug

What happens

Typing a service name in the global search palette filters the list but does not rank it. Results stay in project order, so an exact name match can sit far below weak fuzzy matches. Pressing Enter opens the first item, which is often the wrong service.

Steps to reproduce

  1. Have several projects with a few services each. Create a new service in a later project, e.g. billing.
  2. Press Cmd/Ctrl+J and type billing.
  3. Every service whose text contains the letters of billing in order shows up, in project order. The billing service is not at the top.
  4. Press Enter. It opens the first item in the list, not billing.

Root cause

apps/dokploy/package.json pins cmdk to ^0.2.1. That version's sort is broken:

  • Scores are stored per item id: filtered.items.set(id, score).
  • The sort reads the score by the item's data-value, which is its lowercased text: e.get(item.getAttribute("data-value")).
  • That lookup always returns undefined, so every score counts as 0 and no item moves. Groups are sorted the same way and have the same bug.

cmdk 1.x fixes this by sorting on item.getAttribute("id") (checked in the published [email protected] dist/index.mjs).

The palette's own markup makes the bad order more likely to bite:

  • With no value prop, each service item's value is its full text: project / environment / name plus the service id in a hidden div (components/dashboard/search-command.tsx:159). The random id adds more chance fuzzy matches.
  • Each group wraps its items in an extra <CommandList> (lines 92 and 121) inside the outer one.

Suggested fix

  1. Bump cmdk to ^1.1.1. components/ui/command.tsx already looks like the newer shadcn wrapper written for cmdk 1.x, so the change should be small. Note that 1.x matches value case-sensitively and adds a keywords prop.
  2. Optional: give each service item value={service.name} and keywords={[project.name, environment.name]}, and drop the hidden id div, so the name ranks first and ids stop matching.
  3. Optional: remove the nested <CommandList> wrappers inside the groups.

Related: #5986 (wants Cmd/Ctrl+K for this palette; a separate issue).

主要言語
TypeScript
スター
38.8k
フォーク
3.2k
平均マージ
1日 10時間
マージ済み PR(30日)
110

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Dokploy/dokploy のほかの issue

Dokploy/dokploy の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。