]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts-solr: Limit fetches to SOLR_MAX_MULTI_ROWS
authorJohn Fawcett <john@voipsupport.it>
Wed, 3 Jan 2024 13:48:43 +0000 (14:48 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 29 Apr 2024 20:09:54 +0000 (20:09 +0000)
Solr place upper bound on number of rows to be returned from solr for single
mailbox search When dovecot sends a search to solr it uses the rows parameter.
For multiple mailbox search the value used is SOLR_MAX_MULTI_ROWS , hardcoded to
100000. For single mailbox search the value used is uidnext. This patch
introduces an upper limit for single mailbox search using the same upper bound
as for multiple mailbox searches, SOLR_MAX_MULTI_ROWS, while leaving the
existing functionality of sending the uidnext value if it is smaller. This is
just to place a more reasonable upper bound since uidnext can get much larger
than 100000. The following url points to the Solr documentation for query
parameters that describes the rows parameter:
https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html

src/plugins/fts-solr/fts-backend-solr.c

index 4ab8b14a91fad00ba910362501c76b3629a20e45..6174909f2b7c4d19c3c88a20c25a3540091f8d79 100644 (file)
@@ -845,7 +845,7 @@ fts_backend_solr_lookup(struct fts_backend *_backend, struct mailbox *box,
 
        str = t_str_new(256);
        str_printfa(str, "wt=xml&fl=uid,score&rows=%u&sort=uid+asc&q=%%7b!lucene+q.op%%3dAND%%7d",
-                   status.uidnext);
+                   I_MIN(status.uidnext, SOLR_MAX_MULTI_ROWS));
        prefix_len = str_len(str);
 
        if (solr_add_definite_query_args(str, args, and_args)) {