chibenwa commented on a change in pull request #534:
URL: https://github.com/apache/james-project/pull/534#discussion_r666728442
##########
File path:
mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
##########
@@ -324,6 +325,16 @@ public final int hashCode() {
*/
Publisher<MessageId> search(MultimailboxesSearchQuery expression,
MailboxSession session, long limit) throws MailboxException;
+ /**
+ *
+ * @param threadId
+ * target Thread
+ * @param session
+ * the context for this call, not null
+ * @return a list of MessageId of messages belong to that Thread
+ */
+ Flux<MessageId> getThread(ThreadId threadId, MailboxSession session)
throws MailboxException;
Review comment:
No tests for this method?
##########
File path:
mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
##########
@@ -324,6 +325,16 @@ public final int hashCode() {
*/
Publisher<MessageId> search(MultimailboxesSearchQuery expression,
MailboxSession session, long limit) throws MailboxException;
+ /**
+ *
+ * @param threadId
+ * target Thread
+ * @param session
+ * the context for this call, not null
+ * @return a list of MessageId of messages belong to that Thread
+ */
+ Flux<MessageId> getThread(ThreadId threadId, MailboxSession session)
throws MailboxException;
Review comment:
Use Publisher instead of Mono / Flux in TLD API
This allows subcomponents to not be dependant of the reactive technology...
##########
File path:
mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/SearchThreadIdGuessingAlgorithm.java
##########
@@ -67,6 +67,18 @@ public SearchThreadIdGuessingAlgorithm(MailboxManager
mailboxManager, MessageIdM
.switchIfEmpty(Mono.just(ThreadId.fromBaseMessageId(messageId)));
}
+ @Override
+ public Flux<MessageId> getMessageIdsInThread(ThreadId threadId,
MailboxSession session) throws MailboxException {
+ MultimailboxesSearchQuery expression =
MultimailboxesSearchQuery.from(SearchQuery.matchAll()).build();
+
+ return Flux.from(mailboxManager.search(expression, session,
Long.MAX_VALUE))
+ .collectList()
+ .flatMapMany(messageIds ->
messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session))
+ .filter(messageResult ->
messageResult.getThreadId().equals(threadId))
Review comment:
TODO (Another PR)
Push this to the search engine.
How:
`SearchQuery::withThreadId` and implement it for scanning search, lucene
search as well as ElasticSearch.
--
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]