chibenwa commented on code in PR #2928:
URL: https://github.com/apache/james-project/pull/2928#discussion_r2745705525


##########
mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java:
##########
@@ -362,17 +363,18 @@ protected Flux<MessageUid> doSearch(MailboxSession 
session, Mailbox mailbox, Sea
     }
     
     @Override
-    public Flux<MessageId> search(MailboxSession session, 
Collection<MailboxId> mailboxIds, SearchQuery searchQuery, long limit) {
+    public Flux<MessageId> search(MailboxSession session, 
Collection<MailboxId> mailboxIds, SearchQuery searchQuery, SearchOptions 
searchOptions) {
         Preconditions.checkArgument(session != null, "'session' is mandatory");
 
-        if (mailboxIds.isEmpty()) {
+        if (mailboxIds.isEmpty() || searchOptions.limit() == 0) {
             return Flux.empty();
         }
 
-        return searcher.search(mailboxIds, searchQuery, Optional.empty(), 
MESSAGE_ID_FIELD, !SEARCH_HIGHLIGHT)
-            .handle(this::extractMessageIdFromHit)
-            .distinct()
-            .take(limit);
+        int offset = Math.toIntExact(searchOptions.offset());
+        int limit = Math.toIntExact(searchOptions.limit());
+
+        return searcher.searchCollapsedByMessageId(mailboxIds, searchQuery, 
offset, limit, MESSAGE_ID_FIELD, !SEARCH_HIGHLIGHT)

Review Comment:
   Please pass Search Options to the parameter of the searcher stuff



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to