diff --git a/src/main/java/org/codelibs/fess/indexer/IndexUpdater.java b/src/main/java/org/codelibs/fess/indexer/IndexUpdater.java index 6c2481743..c13c1f93c 100644 --- a/src/main/java/org/codelibs/fess/indexer/IndexUpdater.java +++ b/src/main/java/org/codelibs/fess/indexer/IndexUpdater.java @@ -215,10 +215,21 @@ public class IndexUpdater extends Thread { } else { emptyListCount = 0; // reset } - while (!arList.isEmpty()) { - processAccessResults(docList, accessResultList, arList); - cleanupTime = cleanupAccessResults(accessResultList); + long hitCount = ((EsResultList) arList).getTotalHits(); + while (hitCount > 0) { + if (arList.isEmpty()) { + try { + Thread.sleep(fessConfig.getIndexerWebfsCommitMarginTimeAsInteger().longValue()); + } catch (Exception e) { + // ignore + } + cleanupTime = -1; + } else { + processAccessResults(docList, accessResultList, arList); + cleanupTime = cleanupAccessResults(accessResultList); + } arList = getAccessResultList(cb, cleanupTime); + hitCount = ((EsResultList) arList).getTotalHits(); } if (!docList.isEmpty()) { indexingHelper.sendDocuments(fessEsClient, docList);