Shinsuke Sugaya 9 years ago
parent
commit
1e9d59af9a
1 changed files with 14 additions and 3 deletions
  1. 14 3
      src/main/java/org/codelibs/fess/indexer/IndexUpdater.java

+ 14 - 3
src/main/java/org/codelibs/fess/indexer/IndexUpdater.java

@@ -215,10 +215,21 @@ public class IndexUpdater extends Thread {
                     } else {
                     } else {
                         emptyListCount = 0; // reset
                         emptyListCount = 0; // reset
                     }
                     }
-                    while (!arList.isEmpty()) {
-                        processAccessResults(docList, accessResultList, arList);
-                        cleanupTime = cleanupAccessResults(accessResultList);
+                    long hitCount = ((EsResultList<EsAccessResult>) 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);
                         arList = getAccessResultList(cb, cleanupTime);
+                        hitCount = ((EsResultList<EsAccessResult>) arList).getTotalHits();
                     }
                     }
                     if (!docList.isEmpty()) {
                     if (!docList.isEmpty()) {
                         indexingHelper.sendDocuments(fessEsClient, docList);
                         indexingHelper.sendDocuments(fessEsClient, docList);