Skip to content

Commit

Permalink
registry: Limit results to 1k per docset for queries < 3 symbols (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
trollixx committed Sep 15, 2016
1 parent 6e9bd48 commit a4fac24
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/registry/docset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ QList<SearchResult> Docset::search(const QString &query, const CancellationToken
.arg(searchQuery.sanitizedQuery());
}

// Limit for very short queries.
// TODO: Show a notification about the reduced result set.
if (searchQuery.query().size() < 3)
queryStr += QLatin1String(" LIMIT 1000");

QSqlQuery sqlQuery(queryStr, database());
while (sqlQuery.next() && !token.isCanceled()) {
const QString itemName = sqlQuery.value(0).toString();
Expand Down

0 comments on commit a4fac24

Please sign in to comment.