Class SuggestionSearcher

Class Documentation

class SuggestionSearcher

A SuggestionSearcher is a object suggesting over titles of an Archive

Allows to make “smart” searches on the ZIM entry titles. The search is case and diacritic insensitive. It allows to search patterns in the middle of a title too. It is usually used to provide a title based completion feature.

A SuggestionSearcher is mainly used to create new SuggestionSearch Internally. This is a wrapper around a SuggestionDataBase which may or may not include a Xapian title index (it is optional in the ZIM specification). If the underlying index does not exist, then it will fallback on zim::Archive::findByTitle (with all its limitations).

The underlying Xapian index includes the very same entry titles like for zim::Archive::findByTitle, ie. the one declared as “FRONT_ARTICLE” at ZIM creation time.

You should consider that all search operations are NOT threadsafe. It is up to you to protect your calls to avoid race competition. However, SuggestionSearcher (and subsequent classes) do not maintain a global/ share state You can create several Searchers and use them in different threads.

Public Functions

explicit SuggestionSearcher(const Archive &archive)

SuggestionSearcher constructor.

Construct a SuggestionSearcher on top of an archive.

Parameters:

archive – An archive to suggest on.

SuggestionSearcher(const SuggestionSearcher &other)
SuggestionSearcher &operator=(const SuggestionSearcher &other)
SuggestionSearcher(SuggestionSearcher &&other)
SuggestionSearcher &operator=(SuggestionSearcher &&other)
~SuggestionSearcher()
SuggestionSearch suggest(const std::string &query)

Create a SuggestionSearch for a specific query.

The search is made on the archive under the SuggestionSearcher.

Parameters:

query – The SuggestionQuery to search.

void setVerbose(bool verbose)

Set the verbosity of search operations.

Parameters:

verbose – The verbose mode to set