デバッグ
SearchWP のデバッグは、インデックス作成プロセスと検索プロセスの両方の内部動作を観察しやすくすることを目的としています。デバッグは次のいずれかの方法で有効にできます。
- その他の設定画面の適切なチェックボックスをオンにする
searchwp\debugフックを使用する
デバッグが有効になっている場合、ログファイル(1日1つ)が ~/wp-content/uploads/searchwp-logs/ に作成されます。SearchWP がインデックス作成や検索を実行する際に何を行っているかについての多くの情報が利用可能になります。
注意: データベースクエリはデバッグログに含まれます。デバッグが終了したら、ログファイルを削除してください。
さらに、デバッグが有効になっている場合、検索結果ページのソースに HTML コメントブロックが出力されます。そのリクエストのために実行された検索に関する情報が表示されます。
HTML コメントブロックは次のようになります。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- BEGIN SEARCHWP DEBUG | |
| Query 1 | |
| =============== | |
| Keywords: coffee | |
| Engine: Default | |
| Tokens: coffee | |
| Found Results: 6 | |
| Max Pages: 1 | |
| Query Time: 0.04037 | |
| ┌───────────┬───────┬───────────────────────────────┬──────┐ | |
| │ Relevance │ ID │ Source │ Site │ | |
| ├───────────┼───────┼───────────────────────────────┼──────┤ | |
| │ 561 │ 82719 │ Coffee Roasting Methods │ 1 │ | |
| │ 488 │ 837 │ The best coffee mug supplier │ 1 │ | |
| │ 122 │ 19983 │ How much coffee is too much? │ 1 │ | |
| │ 90 │ 1837 │ Brewing methods compared │ 1 │ | |
| │ 77 │ 1847 │ Best cafe in the area! │ 1 │ | |
| │ 5 │ 20012 │ Espresso machines as gifts │ 1 │ | |
| └───────────┴───────┴───────────────────────────────┴──────┘ | |
| END SEARCHWP DEBUG --> |
デバッグログと HTML コメントブロック出力の両方を使用することで、SearchWP が正確に何を行っているかを把握できます。

