@Test public void reindexSolrServerException() throws QueryException, IOException, SolrServerException { List<String> patientDocs = new ArrayList<>(); patientDocs.add("P0000001"); Query testQuery = mock(Query.class); doReturn(testQuery).when(this.qm).createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL); doReturn(patientDocs).when(testQuery).execute(); doThrow(new SolrServerException("deleteByQuery failed")).when(this.server).deleteByQuery("*:*"); this.patientIndexer.reindex(); verify(this.logger).warn("Failed to reindex patients: {}", "deleteByQuery failed"); }
@Override public void reindex() { try { List<String> patientDocs = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL).execute(); this.server.deleteByQuery("*:*"); for (String patientDoc : patientDocs) { this.internalIndex(this.patientRepository.get(patientDoc), false); } this.server.commit(); } catch (SolrServerException ex) { this.logger.warn("Failed to reindex patients: {}", ex.getMessage()); } catch (IOException ex) { this.logger.warn("Error occurred while reindexing patients: {}", ex.getMessage()); } catch (QueryException ex) { this.logger.warn("Failed to search patients for reindexing: {}", ex.getMessage()); } }
SolrPatientIndexer implements PatientIndexer, Initializable { @Override public void reindex() { try { List<String> patientDocs = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL).execute(); this.server.deleteByQuery("*:*"); for (String patientDoc : patientDocs) { this.internalIndex(this.patientRepository.get(patientDoc), false); } this.server.commit(); } catch (SolrServerException ex) { this.logger.warn("Failed to reindex patients: {}", ex.getMessage()); } catch (IOException ex) { this.logger.warn("Error occurred while reindexing patients: {}", ex.getMessage()); } catch (QueryException ex) { this.logger.warn("Failed to search patients for reindexing: {}", ex.getMessage()); } } }
SolrPatientIndexer implements PatientIndexer, Initializable { @Override public void reindex() { try { List<String> patientDocs = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL).execute(); this.server.deleteByQuery("*:*"); for (String patientDoc : patientDocs) { this.internalIndex(this.patientRepository.get(patientDoc), false); } this.server.commit(); } catch (SolrServerException ex) { this.logger.warn("Failed to reindex patients: {}", ex.getMessage()); } catch (IOException ex) { this.logger.warn("Error occurred while reindexing patients: {}", ex.getMessage()); } catch (QueryException ex) { this.logger.warn("Failed to search patients for reindexing: {}", ex.getMessage()); } }  }
SolrPatientIndexer implements PatientIndexer, Initializable { @Override public void reindex() { try { List<String> patientDocs = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL).execute(); this.server.deleteByQuery("*:*"); for (String patientDoc : patientDocs) { this.internalIndex(this.patientRepository.get(patientDoc), false); } this.server.commit(); } catch (SolrServerException ex) { this.logger.warn("Failed to reindex patients: {}", ex.getMessage()); } catch (IOException ex) { this.logger.warn("Error occurred while reindexing patients: {}", ex.getMessage()); } catch (QueryException ex) { this.logger.warn("Failed to search patients for reindexing: {}", ex.getMessage()); } }  @Override void initialize(); @Override void index(Patient patient); @Override void delete(Patient patient); @Override void reindex(); }
SolrPatientIndexer implements PatientIndexer, Initializable { @Override public void reindex() { try { List<String> patientDocs = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) as patient", Query.XWQL).execute(); this.server.deleteByQuery("*:*"); for (String patientDoc : patientDocs) { this.internalIndex(this.patientRepository.get(patientDoc), false); } this.server.commit(); } catch (SolrServerException ex) { this.logger.warn("Failed to reindex patients: {}", ex.getMessage()); } catch (IOException ex) { this.logger.warn("Error occurred while reindexing patients: {}", ex.getMessage()); } catch (QueryException ex) { this.logger.warn("Failed to search patients for reindexing: {}", ex.getMessage()); } }  @Override void initialize(); @Override void index(Patient patient); @Override void delete(Patient patient); @Override void reindex();  }