Skip to content

v5.4.0

Latest

Choose a tag to compare

@nticaric nticaric released this 30 Nov 07:00
52be709

Much faster snippets, custom PDO options, PHP 8.5 support and a round of fixes for string document IDs and the Redis engine.

Performance

  • snippet() / Highlighter::extractRelevant() is far faster on long text. Match positions are found in one regex pass instead of calling mb_stripos() with an offset in a loop, which re-counted characters from the start of the text on every match. A page of 20 snippets from ~73 KB documents drops from seconds to a few milliseconds; the snippets are unchanged. On PHP 8.4+ a few rare case pairs (e.g. Ƛ/ƛ, Ɤ/ɤ) no longer match case-insensitively. Thanks @ChloeSartorelli. (#375, #376)

Added

  • Custom PDO options through config. Pass them under the options key in loadConfig(), e.g. PDO::MYSQL_ATTR_SSL_CA for managed MySQL providers that require TLS. (#296)
  • PHP 8.5 support: no more deprecation notice for the MySQL buffered-query constant. Thanks @tiller1010. (#374)
  • A snippet benchmark, benchmark/bench_snippet.php.

Fixed

  • String document IDs work again (e.g. "FP_123"). The int type hints on the indexing and delete paths made inserting such documents throw a TypeError. (#365, #213)
  • MySqlConnector discarded every PDO attribute, because array_merge() renumbered the integer option keys.
  • RedisEngine: setFuzzyNoLimit(), setFuzzyMaxExpansions() and search() no longer raise dynamic-property and undefined-property warnings. Thanks @ChloeSartorelli. (#372, #373)
  • RedisEngine: TNTSearch::getIndex() threw Typed property RedisEngine::$index must not be accessed before initialization, so insert(), update() and delete() could not be used. (#377)
  • RedisEngine: integer document IDs are returned as integers, and results are sorted by document ID rather than in the server's KEYS order, as with the other engines. (#377)
  • snippet() no longer raises a float-to-int deprecation notice when the match is near the end of the text. Thanks @ChloeSartorelli. (#370, #371)
  • An empty search word no longer makes Highlighter::_extractLocations() loop forever. (#376)

Full Changelog: v5.3.0...v5.4.0