mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(reverse-index) Fix parallel documents sorting bug
Bug was caused by parallel sorting capturing the iterator rather than the offsets to sort.
This commit is contained in:
parent
d31d8ec5b0
commit
563e388a45
@ -94,16 +94,15 @@ public class ReversePreindexDocuments {
|
|||||||
ExecutorService sortingWorkers = Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors());
|
ExecutorService sortingWorkers = Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors());
|
||||||
|
|
||||||
while (iter.next()) {
|
while (iter.next()) {
|
||||||
|
long iterStart = iter.startOffset;
|
||||||
|
long iterEnd = iter.endOffset;
|
||||||
|
|
||||||
if (iter.size() < 1024) {
|
if (iter.size() < 1024) {
|
||||||
docsFileMap.quickSortN(RECORD_SIZE_LONGS,
|
docsFileMap.quickSortN(RECORD_SIZE_LONGS, iterStart, iterEnd);
|
||||||
iter.startOffset,
|
|
||||||
iter.endOffset);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sortingWorkers.execute(() ->
|
sortingWorkers.execute(() ->
|
||||||
docsFileMap.quickSortN(RECORD_SIZE_LONGS,
|
docsFileMap.quickSortN(RECORD_SIZE_LONGS, iterStart, iterEnd));
|
||||||
iter.startOffset,
|
|
||||||
iter.endOffset));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user