Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search index generation for PHP.net #154

Merged
merged 5 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions phpdotnet/phd/Package/PHP/Web.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,26 @@ protected function writeJsonIndex() {
$ids = array();
$desc = array();
foreach($this->indexes as $id => $index) {
if (!$index["chunk"]) {
continue;
}

if ($index["sdesc"] === "" && $index["ldesc"] !== "") {
$index["sdesc"] = $index["ldesc"];

$parentId = $index['parent_id'];
// isset() to guard against undefined array keys, either for root
// elements (no parent) or in case the index structure is broken.
while (isset($this->indexes[$parentId])) {
kamil-tekiela marked this conversation as resolved.
Show resolved Hide resolved
$parent = $this->indexes[$parentId];
if ($parent['element'] === 'book') {
$index["ldesc"] = Format::getLongDescription($parent['docbook_id']);
break;
}
$parentId = $parent['parent_id'];
}
}

$ids[] = array($index["sdesc"], $index["filename"], $index["element"]);
$desc[$id] = $index["ldesc"];
}
Expand Down
Loading