-
-
Couldn't load subscription status.
- Fork 19
Open
Description
I had to skip this test which is failing for now with most recent libzim:
python-scraperlib/tests/zim/test_indexing.py
Lines 114 to 144 in fef63f8
| def test_indexing_item_not_front(tmp_path: pathlib.Path, png_image: pathlib.Path): | |
| fpath = tmp_path / "test.zim" | |
| main_path = "welcome" | |
| with Creator(fpath, main_path).config_dev_metadata() as creator: | |
| creator.add_item( | |
| StaticItem( | |
| filepath=png_image, | |
| path="welcome", | |
| title="brain food", # title used for suggestions | |
| index_data=IndexData( | |
| title="screen", content="car" # title and content used for search | |
| ), | |
| hints={libzim.writer.Hint.FRONT_ARTICLE: False}, # mark as not front | |
| ) | |
| ) | |
| assert fpath.exists() | |
| reader = Archive(fpath) | |
| # "brain" works as a suggestion but "food" doesn't work because since no front | |
| # article is present in the zim file, libzim doesn't create a title xapian index. | |
| # so, when searching suggestion, libzim is fallback to a binary search on the title | |
| # and return only article starting by the query. | |
| # see https://github.com/openzim/libzim/issues/902#issuecomment-2223050129 | |
| assert "welcome" in list(reader.get_suggestions("brain")) | |
| assert "welcome" not in list(reader.get_suggestions("food")) | |
| assert "welcome" not in list(reader.get_suggestions("screen")) | |
| assert "welcome" not in list(reader.get_suggestions("car")) | |
| assert reader.get_search_results_count("screen") >= 1 | |
| assert reader.get_search_results_count("car") >= 1 | |
| assert reader.get_search_results_count("brain") == 0 | |
| assert reader.get_search_results_count("food") == 0 |
This looks like an upstream issue, hopefully only at read time: openzim/libzim#981