Skip to content

test_indexing_item_not_front test is failing #258

Description

@benoit74

I had to skip this test which is failing for now with most recent libzim:

deftest_indexing_item_not_front(tmp_path: pathlib.Path, png_image: pathlib.Path):
fpath=tmp_path/"test.zim"
main_path="welcome"
withCreator(fpath, main_path).config_dev_metadata() ascreator:
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
)
)
assertfpath.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"inlist(reader.get_suggestions("brain"))
assert"welcome"notinlist(reader.get_suggestions("food"))
assert"welcome"notinlist(reader.get_suggestions("screen"))
assert"welcome"notinlist(reader.get_suggestions("car"))
assertreader.get_search_results_count("screen") >=1
assertreader.get_search_results_count("car") >=1
assertreader.get_search_results_count("brain") ==0
assertreader.get_search_results_count("food") ==0

This looks like an upstream issue, hopefully only at read time: openzim/libzim#981

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions