/** * Gets a connection to the targeted core, used for sending the schema requests. * * @return a valid solr client */ protected SolrClient getClient() { return this.coreConnection.getSolrConnection(getTargetVocabularyId()); }
/** * Delete all the data in the Solr index. * * @return {@code 0} if the command was successful, {@code 1} otherwise */ protected int clear() { try { this.externalServicesAccess.getSolrConnection(this).deleteByQuery("*:*"); return 0; } catch (SolrServerException ex) { this.logger.error("SolrServerException while clearing the Solr index", ex); } catch (IOException ex) { this.logger.error("IOException while clearing the Solr index", ex); } return 1; }
/** * Delete all the data in the Solr index. * * @return {@code 0} if the command was successful, {@code 1} otherwise */ protected int clear() { try { this.externalServicesAccess.getSolrConnection(this).deleteByQuery("*:*"); return 0; } catch (SolrServerException ex) { this.logger.error("SolrServerException while clearing the Solr index", ex); } catch (IOException ex) { this.logger.error("IOException while clearing the Solr index", ex); } return 1; }
/** * Delete all the data in the Solr index. * * @return {@code 0} if the command was successful, {@code 1} otherwise */ protected int clear() { try { this.externalServicesAccess.getSolrConnection(this).deleteByQuery("*:*"); return 0; } catch (SolrServerException ex) { this.logger.error("SolrServerException while clearing the Solr index", ex); } catch (IOException ex) { this.logger.error("IOException while clearing the Solr index", ex); } return 1; }
/** * Gets a connection to the targeted core, used for sending the schema requests. * * @return a valid solr client */ protected SolrClient getClient() { return this.coreConnection.getSolrConnection(this.vocabularyManager.getVocabulary(getTargetVocabularyId())); }
/** * Get the number of entries that match a specific Lucene query. * * @param query a valid Lucene query as string * @return the number of entries matching the query */ protected long count(String query) { SolrQuery params = new SolrQuery(query); params.setStart(0); params.setRows(0); SolrDocumentList results; try { this.logger.debug("Counting terms matching [{}] in [{}]", query, this.getIdentifier()); results = this.externalServicesAccess.getSolrConnection(this).query(params).getResults(); return results.getNumFound(); } catch (Exception ex) { this.logger.error("Failed to count vocabulary terms: {}", ex.getMessage(), ex); return -1; } }
@Override public String getVersion() { QueryResponse response; SolrQuery query = new SolrQuery(); SolrDocumentList termList; SolrDocument firstDoc; query.setQuery("version:*"); query.set(CommonParams.ROWS, "1"); try { response = this.externalServicesAccess.getSolrConnection(this).query(query); termList = response.getResults(); if (!termList.isEmpty()) { firstDoc = termList.get(0); return firstDoc.getFieldValue(VERSION_FIELD_NAME).toString(); } } catch (SolrServerException | SolrException ex) { this.logger.warn("Failed to query vocabulary version: {}", ex.getMessage()); } catch (IOException ex) { this.logger.error("IOException while getting vocabulary version", ex); } return null; } }
@Override public String getVersion() { final SolrQuery query = new SolrQuery(); query.setQuery("version:*"); query.set(CommonParams.ROWS, "1"); try { final QueryResponse response = this.externalServicesAccess.getSolrConnection(this).query(query); final SolrDocumentList termList = response.getResults(); if (!termList.isEmpty()) { final SolrDocument firstDoc = termList.get(0); return firstDoc.getFieldValue(VERSION_FIELD_NAME).toString(); } } catch (SolrServerException | SolrException | IOException ex) { this.logger.warn("Failed to query ontology version: {}", ex.getMessage()); } return null; }
@Override public String getVersion() { QueryResponse response; SolrQuery query = new SolrQuery(); SolrDocumentList termList; SolrDocument firstDoc; query.setQuery("version:*"); query.set("rows", "1"); try { response = this.externalServicesAccess.getSolrConnection(this).query(query); termList = response.getResults(); if (!termList.isEmpty()) { firstDoc = termList.get(0); return firstDoc.getFieldValue(VERSION_FIELD_NAME).toString(); } } catch (SolrServerException | SolrException | IOException ex) { this.logger.warn("Failed to query vocabulary version: {}", ex.getMessage()); } return null; } }
protected VocabularyTerm requestTerm(String queryString, String phraseFields) { QueryResponse response; SolrQuery query = new SolrQuery(); SolrDocumentList termList; VocabularyTerm term; query.setQuery(queryString); query.setRows(1); if (phraseFields != null) { query.set(DisMaxParams.PF, phraseFields); } try { response = this.externalServicesAccess.getSolrConnection(this).query(query); termList = response.getResults(); if (termList != null && !termList.isEmpty()) { term = new SolrVocabularyTerm(termList.get(0), this); return term; } } catch (SolrServerException | SolrException ex) { this.logger.warn("Failed to query vocabulary term: {} ", ex.getMessage()); } catch (IOException ex) { this.logger.error("IOException while getting vocabulary term ", ex); } return null; }
List<SuggestedPhenotype> result = new LinkedList<>(); try { response = this.solrManager.getSolrConnection(this.omim).query(prepareParams(phenotypes, nphenotypes)); } catch (SolrServerException | IOException ex) { this.logger.warn("Failed to query OMIM index: {}", ex.getMessage());
QueryResponse response = this.externalServicesAccess.getSolrConnection(this).query(query); SolrDocumentList results = response.getResults(); if (response.getSpellCheckResponse() != null && !response.getSpellCheckResponse().isCorrectlySpelled() this.logger.debug("Searching [{}] with spellchecked query [{}]", this.getIdentifier(), query); SolrDocumentList spellcheckResults = this.externalServicesAccess.getSolrConnection(this).query(query).getResults(); if (results.getMaxScore() < spellcheckResults.getMaxScore()) { results = spellcheckResults;