Class SearchRenderer

Class Documentation

class SearchRenderer

The SearcherRenderer class is used to render a search result to a html page.

Public Functions

SearchRenderer(zim::SearchResultSet srs, NameMapper *mapper, unsigned int start, unsigned int estimatedResultCount)

Construct a SearchRenderer from a SearchResultSet.

The constructed version of the SearchRenderer will not introduce the book name for each result. It is better to use the other constructor with a Library pointer to have a better html page.

Parameters
  • srs – The SearchResultSet to render.

  • mapper – The NameMapper to use to do the rendering.

  • start – The start offset used for the srs.

  • estimatedResultCount – The estimatedResultCount of the whole search

SearchRenderer(zim::SearchResultSet srs, NameMapper *mapper, Library *library, unsigned int start, unsigned int estimatedResultCount)

Construct a SearchRenderer from a SearchResultSet.

Parameters
  • srs – The SearchResultSet to render.

  • mapper – The NameMapper to use to do the rendering.

  • library – The Library to use to look up book details for search results.

  • start – The start offset used for the srs.

  • estimatedResultCount – The estimatedResultCount of the whole search

~SearchRenderer()
void setSearchPattern(const std::string &pattern)

Set the search pattern used to do the search

void setSearchBookQuery(const std::string &bookQuery)

Set the querystring used to select books

void setProtocolPrefix(const std::string &prefix)

Set protocol prefix.

void setSearchProtocolPrefix(const std::string &prefix)

Set search protocol prefix.

inline void setPageLength(unsigned int pageLength)

set result count per page

std::string renderTemplate(const std::string &tmpl_str)
std::string getHtml()

Generate the html page with the resutls of the search.

std::string getXml()

Generate the xml page with the resutls of the search.

Protected Functions

std::string beautifyInteger(const unsigned int number)

Protected Attributes

zim::SearchResultSet m_srs
NameMapper *mp_nameMapper
Library *mp_library
std::string searchBookQuery
std::string searchPattern
std::string protocolPrefix
std::string searchProtocolPrefix
unsigned int pageLength
unsigned int estimatedResultCount
unsigned int resultStart