Пример #1
0
 public int updateFetchStatus(
     AbstractSearchRequest searchRequest, FetchStatus fetchStatus, int bufferSize, TaskLog taskLog)
     throws SearchLibException {
   setCurrentTaskLog(taskLog);
   try {
     int total = 0;
     FileItemFieldEnum.INSTANCE.fetchStatus.addFilterQuery(
         searchRequest, fetchStatus.value, false, true);
     List<FileItem> fileItemList = new ArrayList<FileItem>();
     for (; ; ) {
       fileItemList.clear();
       getFileList(searchRequest, 0, bufferSize, fileItemList);
       if (fileItemList.size() == 0) break;
       for (FileItem fileItem : fileItemList) fileItem.setFetchStatus(fetchStatus);
       updateFileItems(fileItemList);
       total += fileItemList.size();
       taskLog.setInfo(total + " URI(s) updated");
       if (taskLog.isAbortRequested()) throw new SearchLibException.AbortException();
     }
     return total;
   } catch (ParseException e) {
     throw new SearchLibException(e);
   } finally {
     resetCurrentTaskLog();
   }
 }
Пример #2
0
 public int delete(AbstractSearchRequest searchRequest, TaskLog taskLog)
     throws SearchLibException {
   setCurrentTaskLog(taskLog);
   try {
     int total = 0;
     List<FileItem> itemList = new ArrayList<FileItem>();
     for (; ; ) {
       itemList.clear();
       getFileList(searchRequest, 0, 1000, itemList);
       if (itemList.size() == 0) break;
       List<String> uriList = new ArrayList<String>(itemList.size());
       for (FileItem fileItem : itemList) uriList.add(fileItem.getUri());
       dbClient.deleteDocuments(FileItemFieldEnum.INSTANCE.uri.getName(), uriList);
       total += itemList.size();
       taskLog.setInfo(total + " URI(s) deleted");
       if (taskLog.isAbortRequested()) throw new SearchLibException.AbortException();
     }
     return total;
   } finally {
     resetCurrentTaskLog();
   }
 }