mirror of https://github.com/M66B/FairEmail.git
Batch search fix
This commit is contained in:
parent
76f7897489
commit
6e4af2ed03
|
@ -181,6 +181,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
db.beginTransaction();
|
||||
|
||||
while (found < pageSize && !state.destroyed) {
|
||||
if (state.matches == null ||
|
||||
(state.matches.size() > 0 && state.index >= state.matches.size())) {
|
||||
state.matches = db.message().matchMessages(
|
||||
folder,
|
||||
"%" + find + "%",
|
||||
|
@ -196,6 +198,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
if (state.matches.size() == 0)
|
||||
break;
|
||||
|
||||
state.offset += Math.min(state.matches.size(), SEARCH_LIMIT);
|
||||
state.index = 0;
|
||||
}
|
||||
|
||||
for (int i = state.index; i < state.matches.size() && found < pageSize && !state.destroyed; i++) {
|
||||
state.index = i + 1;
|
||||
|
||||
|
@ -223,8 +229,6 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
db.message().setMessageFound(match.account, match.thread);
|
||||
}
|
||||
}
|
||||
|
||||
state.offset += SEARCH_LIMIT;
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
|
Loading…
Reference in New Issue