Skip to content

Commit

Permalink
Fix documentation of getResults
Browse files Browse the repository at this point in the history
getReturn should follow the same convention used by Xapian for
consistency. The second argument maxResults is the maximum number of
results to return starting from the first argument start.
  • Loading branch information
maneeshpm authored and kelson42 committed Aug 4, 2021
1 parent 953cba7 commit 6a0bcbe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/zim/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ class Search
*
* @param start The begining of the range to get
* (offset of the first result).
* @param end The end of the range to get
* (offset of the result past the end of the range).
* @param maxResults The maximum number of results to return
* (offset of last result from the start of range).
*/
const SearchResultSet getResults(int start, int end) const;
const SearchResultSet getResults(int start, int maxResults) const;

/** Get the number of estimated results for this search.
*
Expand Down
4 changes: 2 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ int Search::getEstimatedMatches() const
}
}

const SearchResultSet Search::getResults(int start, int end) const {
const SearchResultSet Search::getResults(int start, int maxResults) const {
try {
auto enquire = getEnquire();
auto mset = enquire.get_mset(start, end);
auto mset = enquire.get_mset(start, maxResults);
return SearchResultSet(mp_internalDb, std::move(mset));
} catch(Xapian::QueryParserError& e) {
return SearchResultSet(mp_internalDb);
Expand Down
4 changes: 2 additions & 2 deletions test/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ TEST(Search, multiSearch)
ASSERT_EQ(result2.size(), 3);

// Check result retrieval in middle ranges
auto result3 = search0.getResults(2, 3); // Should Return 1 result
ASSERT_EQ(result3.size(), 1); // Fails!
auto result3 = search0.getResults(2, 3); // Should Return 3 result
ASSERT_EQ(result3.size(), 3);

// Be able to do a different search using the same searcher.
query.setQuery("super", false);
Expand Down

0 comments on commit 6a0bcbe

Please sign in to comment.