Skip to content

Commit f40a0ef

Browse files
author
bugfix-mission
committed
fix(zim): correct config_indexing docstring to full-text only
The docstring of Creator.config_indexing claimed it toggled both full-text and title indexing, but libzim only toggles the full-text index; the title index is always built. Update the docstring to reflect libzim's actual behaviour and add a regression test.
1 parent 1fdc823 commit f40a0ef

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Fix installation from source, which missed wombatSetup.js (#287)
2121
- Fix outdated system dependencies in README: remove Pillow build-time deps (bundled in wheels), add missing `libcairo` across all platforms (#152)
2222
- Improve contribution setup instructions: use `hatch shell`, clarify commands must be run from local clone root (#153)
23+
- Fix `Creator.config_indexing` docstring to reflect that only the full-text index is toggled; title indexing is always performed by libzim (#294)
2324

2425
### Changed
2526

src/zimscraperlib/zim/creator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ def __init__(
127127
def config_indexing(
128128
self, indexing: bool, language: str | None = None # noqa: FBT001
129129
):
130-
"""Toggle full-text and title indexing of entries
130+
"""Toggle full-text indexing of entries
131131
132-
Uses Language metadata's value (or "") if not set"""
132+
Uses Language metadata's value (or "") if not set.
133+
134+
Note: title indexing is always performed by libzim and cannot be
135+
disabled via this method; only the full-text index is toggled."""
133136
language = language or self._get_first_language_metadata_value() or ""
134137
if indexing and not is_valid_iso_639_3(language):
135138
raise ValueError("Not a valid ISO-639-3 language code")

tests/zim/test_zim_creator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,3 +973,11 @@ def test_config_indexing(tmp_path: pathlib.Path):
973973
assert Creator(tmp_path / "_.zim", "").config_indexing(True, "bam")
974974
assert Creator(tmp_path / "_.zim", "").config_indexing(False, "bam")
975975
assert Creator(tmp_path / "_.zim", "").config_indexing(False)
976+
977+
978+
def test_config_indexing_docstring_only_mentions_full_text():
979+
"""Regression test for #294: docstring must not claim title indexing
980+
is toggled (libzim only toggles the full-text index)."""
981+
doc = Creator.config_indexing.__doc__ or ""
982+
assert "full-text" in doc
983+
assert "full-text and title indexing" not in doc

0 commit comments

Comments
 (0)