Difference between revisions of "Libzim"

Jump to navigation Jump to search
Line 99: Line 99:


The simpler searches articles by title either by a praefix or by a range of titles. You pass a namespace and either a single ''std::string'' and you get all articles, whose title starts with that string or you pass two strings and you get all articles whose title is between these strings (including the passed strings).
The simpler searches articles by title either by a praefix or by a range of titles. You pass a namespace and either a single ''std::string'' and you get all articles, whose title starts with that string or you pass two strings and you get all articles whose title is between these strings (including the passed strings).
The method zim::Search::search implements a full text search. For that it needs the full text index file. The full text index file is also a zim file, so you pass the index file as second paramter of type zim::File. The search-method is then called with the SearchResults-reference and a string, containing a space delimited list of words. The full text search then returns a list of articles where at least one of the words is found. Each article is weighted and the result is sorted by weight starting with the highest weighted article.