Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Incorrect grouping of search results between "Extensions" and "Other Matches"

オープン
#1,088 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, php
領域
frontend, search

調査の方向性

js/search.js の 130-141 行付近にあるグループ化ロジックから始め、要素に基づくその前提を、提供されている PHP Manual SQLite index dump および列挙された例と比較します。結果の種類で拡張ページと一般的なマニュアルページをどのように区別すべきかを判断し、Security、apcu、pdo などの結果が正しいグループに表示されることを確認します。

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

説明

Background

In https://github.com/php/phd/pull/154, we resolved the issue of missing pages in the search index. However, now that these pages are visible in search results, a long-standing bug in result grouping has become apparent.

Issue

Some search results are incorrectly categorized between the "Extensions" and "Other Matches" groups.

Example:

image
Query: security

As shown:

  1. "Security (PHP Manual)" appears in the "Extensions" group, although it is not a PHP extension.
  2. "Security consideration" (from the win32service extension) is incorrectly placed in the "Other Matches" group.

Cause

The client-side search code groups results based on types, including Function, Variable, Class, Exception, Extension, and Other Matches (general). These types are assigned according to the XML element tags in the manual's source.

Issue 1: Incorrect grouping in "Extensions"

The first issue occurs in this section of the code:

https://github.com/php/web-php/blob/27fbef13e912547b4086793a5dd2e04fc0fcf684/js/search.js#L130-L134

The code assumes that any entry with the element tag <book>, <set>, or <reference> is related to extensions, which is inaccurate. Many entries, though using these elements, do not belong to extensions.

Example data:

id ldesc element
getting-started Getting Started book
install Installation and Configuration book
... ... ...
reserved.variables Predefined Variables reference
wrappers Supported Protocols and Wrappers reference
... ... ...
SELECT "docbook_id", "ldesc", "element"
FROM "ids" 
WHERE "element" IN ('book','set','reference')
Issue 2: Incorrect grouping in "Other Matches"

The second issue is due to an assumption in the following code:

https://github.com/php/web-php/blob/27fbef13e912547b4086793a5dd2e04fc0fcf684/js/search.js#L136-L141

The code assumes that entries with the tags <section>, <chapter>, <appendix>, or <article> do not belong to an extension. While this is not as bad, there are many pages that are part of an extension but are currently placed in the "Other Matches" group:

id ldesc element
... ... ...
apcu.installation Installation section
apcu.configuration Runtime Configuration section
... ... ...
pdo.setup Installing/Configuring chapter
pdo.constants Predefined Constants appendix
pdo.connections Connections and Connection management chapter
... ... ...
SELECT "docbook_id", "ldesc", "element"
FROM "ids" 
WHERE "element" IN ('section','chapter','appendix','article')

PHP Manual index dump

For convenience, here is the dump from the PHD SQLite index for the PHP Manual: php-manual-index_2024-10-08.sql.gz

Notes

  • This will continue to be relevant even after #1084 is merged, as it uses the same logic for displaying the result type.
  • The screenshot has the upcoming fix for https://github.com/php/phd/issues/159 applied.
主要言語
PHP
スター
1.1k
フォーク
641
平均マージ
22時間 36分
マージ済み PR(30日)
16

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

php/web-php のほかの issue

php/web-php の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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