Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix installation from source, which missed wombatSetup.js (#287)
- Fix outdated system dependencies in README: remove Pillow build-time deps (bundled in wheels), add missing `libcairo` across all platforms (#152)
- Improve contribution setup instructions: use `hatch shell`, clarify commands must be run from local clone root (#153)
- Fix `Creator.config_indexing` docstring to reflect that only the full-text index is toggled; title indexing is always performed by libzim (#294)

### Changed

Expand Down
7 changes: 5 additions & 2 deletions src/zimscraperlib/zim/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ def __init__(
def config_indexing(
self, indexing: bool, language: str | None = None # noqa: FBT001
):
"""Toggle full-text and title indexing of entries
"""Toggle full-text indexing of entries

Uses Language metadata's value (or "") if not set"""
Uses Language metadata's value (or "") if not set.

Note: title indexing is always performed by libzim and cannot be
disabled via this method; only the full-text index is toggled."""
language = language or self._get_first_language_metadata_value() or ""
if indexing and not is_valid_iso_639_3(language):
raise ValueError("Not a valid ISO-639-3 language code")
Expand Down
8 changes: 8 additions & 0 deletions tests/zim/test_zim_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,3 +973,11 @@ def test_config_indexing(tmp_path: pathlib.Path):
assert Creator(tmp_path / "_.zim", "").config_indexing(True, "bam")
assert Creator(tmp_path / "_.zim", "").config_indexing(False, "bam")
assert Creator(tmp_path / "_.zim", "").config_indexing(False)


def test_config_indexing_docstring_only_mentions_full_text():
"""Regression test for #294: docstring must not claim title indexing
is toggled (libzim only toggles the full-text index)."""
doc = Creator.config_indexing.__doc__ or ""
assert "full-text" in doc
assert "full-text and title indexing" not in doc