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

Fix search index for entries without parent book #160

Merged
merged 4 commits into from
Nov 3, 2024

Conversation

lhsazevedo
Copy link
Contributor

@lhsazevedo lhsazevedo commented Oct 8, 2024

Fixes #159

This commit enhances the search index generation process by providing more meaningful subtitles (descriptions) for entries that lack a parent <book> element.

id title current subtitle new subtitle
copyright Copyright Copyright PHP Manual
preface Preface Preface PHP Manual
... ... ... ...
book.opcache OPcache OPcache Affecting PHP's Behaviour
refs.basic.php Affecting PHP's Behaviour Affecting PHP's Behaviour Function Reference
... ... ... ...
View the entire table
id title current subtitle new subtitle
copyright Copyright Copyright PHP Manual
preface Preface Preface PHP Manual
getting-started Getting Started Getting Started PHP Manual
install Installation and Configuration Installation and Configuration PHP Manual
langref Language Reference Language Reference PHP Manual
security Security Security PHP Manual
features Features Features PHP Manual
book.opcache OPcache OPcache Affecting PHP's Behaviour
refs.basic.php Affecting PHP's Behaviour Affecting PHP's Behaviour Function Reference
refs.utilspec.audio Audio Formats Manipulation Audio Formats Manipulation Function Reference
book.radius Radius Radius Authentication Services
refs.remote.auth Authentication Services Authentication Services Function Reference
refs.utilspec.cmdline Command Line Specific Extensions Command Line Specific Extensions Function Reference
book.bzip2 Bzip2 Bzip2 Compression and Archive Extensions
book.phar Phar Phar Compression and Archive Extensions
book.zip Zip Zip Compression and Archive Extensions
refs.compression Compression and Archive Extensions Compression and Archive Extensions Function Reference
book.mcrypt Mcrypt Mcrypt Cryptography Extensions
book.mhash Mhash Mhash Cryptography Extensions
book.openssl OpenSSL OpenSSL Cryptography Extensions
book.password Password Hashing Password Hashing Cryptography Extensions
refs.crypto Cryptography Extensions Cryptography Extensions Function Reference
refs.database.abstract Abstraction Layers Abstraction Layers Database Extensions
book.dbase dBase dBase Vendor Specific Database Extensions
book.ibase Firebird/InterBase Firebird/InterBase Vendor Specific Database Extensions
mongodb.setup Installing/Configuring Installing/Configuring MongoDB Extension
mongodb.security Security Security MongoDB Extension
mysql Overview of the MySQL PHP drivers Overview of the MySQL PHP drivers MySQL Drivers and Plugins
book.pgsql PostgreSQL PostgreSQL Vendor Specific Database Extensions
refs.database.vendors Vendor Specific Database Extensions Vendor Specific Database Extensions Database Extensions
refs.database Database Extensions Database Extensions Function Reference
book.calendar Calendar Calendar Date and Time Related Extensions
refs.calendar Date and Time Related Extensions Date and Time Related Extensions Function Reference
book.dio Direct IO Direct IO File System Related Extensions
book.dir Directories Directories File System Related Extensions
book.filesystem Filesystem Filesystem File System Related Extensions
book.inotify Inotify Inotify File System Related Extensions
book.xattr xattr xattr File System Related Extensions
book.xdiff xdiff xdiff File System Related Extensions
refs.fileprocess.file File System Related Extensions File System Related Extensions Function Reference
book.gettext Gettext Gettext Human Language and Character Encoding Support
book.iconv iconv iconv Human Language and Character Encoding Support
book.mbstring Multibyte String Multibyte String Human Language and Character Encoding Support
book.pspell Pspell Pspell Human Language and Character Encoding Support
refs.international Human Language and Character Encoding Support Human Language and Character Encoding Support Function Reference
refs.utilspec.image Image Processing and Generation Image Processing and Generation Function Reference
book.mail Mail Mail Mail Related Extensions
book.mailparse Mailparse Mailparse Mail Related Extensions
refs.remote.mail Mail Related Extensions Mail Related Extensions Function Reference
book.stats Statistics Statistics Mathematical Extensions
refs.math Mathematical Extensions Mathematical Extensions Function Reference
book.xlswriter XLSWriter XLSWriter Non-Text MIME Output
refs.utilspec.nontext Non-Text MIME Output Non-Text MIME Output Function Reference
book.expect Expect Expect Process Control Extensions
book.posix POSIX POSIX Process Control Extensions
book.shmop Shared Memory Shared Memory Process Control Extensions
refs.fileprocess.process Process Control Extensions Process Control Extensions Function Reference
book.stream Streams Streams Other Basic Extensions
book.swoole Swoole Swoole Other Basic Extensions
book.tidy Tidy Tidy Other Basic Extensions
book.tokenizer Tokenizer Tokenizer Other Basic Extensions
book.url URLs URLs Other Basic Extensions
book.ds Data Structures Data Structures Other Basic Extensions
refs.basic.other Other Basic Extensions Other Basic Extensions Function Reference
book.ftp FTP FTP Other Services
book.memcache Memcache Memcache Other Services
book.mqseries mqseries mqseries Other Services
book.network Network Network Other Services
book.snmp SNMP SNMP Other Services
book.sockets Sockets Sockets Other Services
book.yaz YAZ YAZ Other Services
refs.remote.other Other Services Other Services Function Reference
refs.search Search Engine Extensions Search Engine Extensions Function Reference
book.apache Apache Apache Server Specific Extensions
book.fpm FastCGI Process Manager FastCGI Process Manager Server Specific Extensions
refs.utilspec.server Server Specific Extensions Server Specific Extensions Function Reference
refs.basic.session Session Extensions Session Extensions Function Reference
book.strings Strings Strings Text Processing
refs.basic.text Text Processing Text Processing Function Reference
book.array Arrays Arrays Variable and Type Related Extensions
book.funchand Function Handling Function Handling Variable and Type Related Extensions
book.var Variable handling Variable handling Variable and Type Related Extensions
refs.basic.vartype Variable and Type Related Extensions Variable and Type Related Extensions Function Reference
book.oauth OAuth OAuth Web Services
book.xmlrpc XML-RPC XML-RPC Web Services
refs.webservice Web Services Web Services Function Reference
book.win32service win32service win32service Windows Only Extensions
refs.utilspec.windows Windows Only Extensions Windows Only Extensions Function Reference
book.libxml libxml libxml XML Manipulation
book.simplexml SimpleXML SimpleXML XML Manipulation
book.wddx WDDX WDDX XML Manipulation
book.xml XML Parser XML Parser XML Manipulation
book.xmlreader XMLReader XMLReader XML Manipulation
book.xmlwriter XMLWriter XMLWriter XML Manipulation
book.xsl XSL XSL XML Manipulation
refs.xml XML Manipulation XML Manipulation Function Reference
refs.ui GUI Extensions GUI Extensions Function Reference
funcref Function Reference Function Reference PHP Manual
appendices Appendices Appendices PHP Manual

This commit enhances the search index generation process by providing
more meaningful descriptions for entries that lack a parent <book>
element. Additionally, refactors writeJsonIndex() into smaller methods.

Fixes php#159
@lhsazevedo lhsazevedo changed the title Fix search index for entries without parent books Fix search index for entries without parent book Oct 8, 2024
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't really dealt much with the indexing part of PhD, maybe @haszi knows more about.


// 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[$id])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use array_key_exists() as isset() will return false if the key exists, but the associated value is null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for the suggestion

Copy link
Contributor

@haszi haszi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have one comment and a nit, but looks good in general. One thing I would really like to see is some tests for this though.

phpdotnet/phd/Package/PHP/Web.php Outdated Show resolved Hide resolved
phpdotnet/phd/Package/PHP/Web.php Outdated Show resolved Hide resolved
@lhsazevedo lhsazevedo force-pushed the fix/search-descriptions branch from 44052a0 to 4ba7d78 Compare October 31, 2024 18:53
@lhsazevedo
Copy link
Contributor Author

One thing I would really like to see is some tests for this though.

It appears there aren’t any tests yet for the Package_PHP_XHTML class, and I’d be happy to write an initial test for these methods, though I can only start next week or so.

To keep things moving, I can create an issue specifically for adding these tests in a follow-up PR. This way, we can proceed with the merge now, and we’ll have a clear plan to cover the tests soon after.

Does that work for you?

@haszi
Copy link
Contributor

haszi commented Nov 3, 2024

To keep things moving, I can create an issue specifically for adding these tests in a follow-up PR. This way, we can proceed with the merge now, and we’ll have a clear plan to cover the tests soon after.

Does that work for you?

I'm OK with that as long as the tests for the two new methods are added soonish. :-)

@Girgias Girgias merged commit c578cc9 into php:master Nov 3, 2024
9 checks passed
@lhsazevedo lhsazevedo deleted the fix/search-descriptions branch November 3, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated titles and descriptions in search index for chunks without parent book
3 participants