mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #778 from kiwix/small_fixes
This commit is contained in:
commit
c4f706863c
|
@ -76,10 +76,10 @@ class Searcher
|
||||||
* @return true if the reader has been added.
|
* @return true if the reader has been added.
|
||||||
* false if the reader cannot be added (no embedded fulltext index present)
|
* false if the reader cannot be added (no embedded fulltext index present)
|
||||||
*/
|
*/
|
||||||
bool add_reader(Reader* reader);
|
bool add_reader(std::shared_ptr<Reader> reader);
|
||||||
|
|
||||||
|
|
||||||
Reader* get_reader(int index);
|
std::shared_ptr<Reader> get_reader(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a search on the zim associated to the Searcher.
|
* Start a search on the zim associated to the Searcher.
|
||||||
|
@ -161,7 +161,7 @@ class Searcher
|
||||||
const unsigned int maxResultCount,
|
const unsigned int maxResultCount,
|
||||||
const bool verbose = false);
|
const bool verbose = false);
|
||||||
|
|
||||||
std::vector<Reader*> readers;
|
std::vector<std::shared_ptr<Reader>> readers;
|
||||||
std::unique_ptr<SearcherInternal> internal;
|
std::unique_ptr<SearcherInternal> internal;
|
||||||
std::unique_ptr<SuggestionInternal> suggestionInternal;
|
std::unique_ptr<SuggestionInternal> suggestionInternal;
|
||||||
std::string searchPattern;
|
std::string searchPattern;
|
||||||
|
|
|
@ -40,11 +40,12 @@ namespace kiwix
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
SearchRenderer::SearchRenderer(Searcher* searcher, NameMapper* mapper)
|
SearchRenderer::SearchRenderer(Searcher* searcher, NameMapper* mapper)
|
||||||
: SearchRenderer(
|
: SearchRenderer(
|
||||||
searcher->getSearchResultSet(),
|
/* srs */ searcher->getSearchResultSet(),
|
||||||
mapper,
|
/* mapper */ mapper,
|
||||||
nullptr,
|
/* library */ nullptr,
|
||||||
searcher->getEstimatedResultCount(),
|
/* start */ searcher->getResultStart(),
|
||||||
searcher->getResultStart())
|
/* estimatedResultCount */ searcher->getEstimatedResultCount()
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SearchRenderer::SearchRenderer(zim::SearchResultSet srs, NameMapper* mapper,
|
SearchRenderer::SearchRenderer(zim::SearchResultSet srs, NameMapper* mapper,
|
||||||
|
|
|
@ -89,13 +89,13 @@ Searcher::~Searcher()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Searcher::add_reader(Reader* reader)
|
bool Searcher::add_reader(std::shared_ptr<Reader> reader)
|
||||||
{
|
{
|
||||||
if (!reader->hasFulltextIndex()) {
|
if (!reader->hasFulltextIndex()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( const Reader* const existing_reader : readers ) {
|
for ( auto existing_reader : readers ) {
|
||||||
if ( existing_reader->getZimArchive()->getUuid() == reader->getZimArchive()->getUuid() )
|
if ( existing_reader->getZimArchive()->getUuid() == reader->getZimArchive()->getUuid() )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ bool Searcher::add_reader(Reader* reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Reader* Searcher::get_reader(int readerIndex)
|
std::shared_ptr<Reader> Searcher::get_reader(int readerIndex)
|
||||||
{
|
{
|
||||||
return readers.at(readerIndex);
|
return readers.at(readerIndex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue