quantranhong1999 commented on code in PR #2750:
URL: https://github.com/apache/james-project/pull/2750#discussion_r2166381172
##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraThreadIdGuessingAlgorithm.java:
##########
@@ -88,17 +86,17 @@ public Flux<MessageId> getMessageIdsInThread(ThreadId
threadId, MailboxSession s
return Flux.just(threadId.getBaseMessageId());
}
- SearchQuery searchQuery = SearchQuery.builder()
- .andCriteria(SearchQuery.threadId(threadId))
- .sorts(new SearchQuery.Sort(SearchQuery.Sort.SortClause.Arrival,
SearchQuery.Sort.Order.NATURAL))
- .build();
-
- MultimailboxesSearchQuery expression = MultimailboxesSearchQuery
- .from(searchQuery)
- .build();
-
- return Flux.from(mailboxManager.search(expression, session,
Integer.MAX_VALUE))
- .switchIfEmpty(Mono.error(() -> new
ThreadNotFoundException(threadId)));
+ return threadLookupDAO.selectAll(threadId)
+ .collectList()
+ .map(ids -> {
+ // Handle umpopulated lookup dao
+ if (ids.isEmpty()) {
+ return ImmutableList.of(threadId.getBaseMessageId());
+ }
+ return ids;
+ })
+ .flatMapMany(messageIds ->
messageIdManager.accessibleMessagesReactive(messageIds, session))
Review Comment:
JMAP Thread specs say we should have Thread/get ordering by date.
<img width="709" alt="image"
src="https://github.com/user-attachments/assets/f00ab5d1-f613-4135-a52d-156ec5f562d7"
/>
Using filter should be simple enough to retain ordering:
```java
.flatMap(ids ->
Mono.from(messageIdManager.accessibleMessagesReactive(ids, session))
.map(accessibleSet -> {
return ids.stream()
.filter(accessibleSet::contains)
.collect(ImmutableList.toImmutableList());
})
)
.flatMapMany(Flux::fromIterable);
```
--
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]