Local search ranks literal identifier matches by title, not by how often the term appears
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 77/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- hugo, javascript
- 領域
- search
調査の方向性
assets/js/search-engine.jsから始めます。ここでは、リテラルな識別子のクエリがスコア付けされ、比較されています。付属のNode再現コードを使って、現在の並び順を確認してください。次に、同じフィールドで一致するページ間では、出現回数が多いほど上位に表示され、タイトル順は引き続き同点時の判定基準になることを確認してください。再度再現コードを実行し、Query referenceがAlpha notesより前に表示されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Version: v1.5.0 (84b93e4)
What happens
A query that contains _, . or - (for example top_k) skips Lunr and is matched literally in assets/js/search-engine.js. A page's score for the term is the weight of the highest field that contains it (title 100, keywords 80, headings 50, body 10), with no count of occurrences. Pages that mention the identifier only in body text all score 10, and compare() then orders them by title. A page that mentions the term once in passing ranks above the page that documents it.
On a 45-page docs site, top_k appears in the body of 15 pages, and the top five results are the first five titles in alphabetical order. The pages that define the parameter come later. With v1.1.0 the same query went through Lunr and ranked those pages first.
Minimal reproduction (no site build needed)
// node repro.cjs path/to/oink/assets/js/search-engine.js
global.window = {};
const engine = require(process.argv[2]);
const docs = [
{ ref: '/a/', title: 'Alpha notes', body: 'Benchmarks ran with top_k set to 10.' },
{ ref: '/q/', title: 'Query reference',
body: 'top_k: number of results. Set top_k to 5 for short answers. top_k must be ' +
'between 1 and 100. When top_k exceeds the candidate pool, fewer results return.' },
];
console.log(engine.create(docs, null, 10).query('top_k').map((r) => r.doc.title));
Output: [ 'Alpha notes', 'Query reference' ]. Renaming "Alpha notes" to "Zulu notes" reverses the order, so the title is the tie-breaker.
Expected
Among pages that match in the same field, the page where the term occurs more often ranks higher.
Possible direction
Add an occurrence count within a field tier, for example weight + min(count, 10), before falling back to the title order. search_keywords works as a per-page workaround today.
- 主要言語
- HTML
- スター
- 164
- フォーク
- 19
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
TestCheckIndex.testCorruptSegmentInfoNamesTheSegment failure.対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンtype:test
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
apache/lucene#17012 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
geovanneb/get-things-done#384 ·
メンテナーはふだん 1 日以内に返信
-
Search with an index backend (FAISS) raises `KeyError` when a query has no `top_ranked` candidatesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
embeddings-benchmark/mteb#5867 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
app-server bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openai/codex#60595 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信