public QueryResponse run() throws IOException, SolrServerException { return server.query(solrQuery); } });
private QueryResponse executeQuery(SolrQuery query) { QueryResponse queryResponse; try { queryResponse = solrServer.query(query); } catch (SolrServerException e) { throw new IntactSolrException("Problem searching with query: "+query, e); } return queryResponse; } }
private QueryResponse executeQuery(SolrQuery query) { QueryResponse queryResponse; try { queryResponse = solrServer.query(query); } catch (SolrServerException e) { throw new IntactSolrException("Problem searching with query: "+query, e); } return queryResponse; } }
private QueryResponse executeSolrQuery(SolrServer solrServer, SolrParams solrQuery) throws SearchException { try { return solrServer.query(solrQuery); } catch (SolrServerException e) { String msg = "Failed to execute solr query"; log.error(msg, e); throw new SearchException(msg, e); } }
public SolrDocumentList runQuery(SolrQuery query, int results) throws SolrServerException { QueryResponse rsp = server.query(query); return rsp.getResults(); }
public QueryResponse search(SolrQuery query, String [] fieldNames) throws SolrServerException{ if (fieldNames != null && fieldNames.length > 0){ query.setFields(fieldNames); } // order by unique id query.addSortField(OntologyFieldNames.ID, SolrQuery.ORDER.asc); return solrServer.query(query); }
SolrDocumentList simpleSolrQuery(SolrServer solr, String query, int rows) throws SolrServerException { SolrQuery solrQuery = new SolrQuery(query); solrQuery.setRows(rows); QueryResponse resp = solr.query(solrQuery); SolrDocumentList hits = resp.getResults(); return hits; }
private Exception query(String query) { SolrServer server = openReadConnection(); SolrQuery solrQuery = new SolrQuery(query); solrQuery.setRows(0); try { server.query(solrQuery); return null; } catch (SolrServerException error) { return error; } } };
public Iterator<SolrDocument> getCandidates(String title) throws SolrServerException { String etitle = escape(title); //<co id="co.rm.escape"/> query.setQuery("title:\""+etitle+"\""); //<co id="co.rm.quotes"/> QueryResponse response = solr.query(query); SolrDocumentList dl = response.getResults(); return dl.iterator(); } /*
public static SolrDocumentList query(SolrServer server, SolrQuery solrParams) throws DSpaceSolrException { try { solrParams.addSortField("item.id", ORDER.asc); QueryResponse response = server.query(solrParams); return response.getResults(); } catch (SolrServerException ex) { throw new DSpaceSolrException(ex.getMessage(), ex); } }
SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); ModifiableSolrParams params = new ModifiableSolrParams(); params.set("qt", "/dataimport"); params.set("command", "full-import"); QueryResponse response = solrServer.query(params);
private long countDocs(SolrServer ontologiesSolrServer) throws SolrServerException { SolrQuery countQuery = new SolrQuery("*:*"); countQuery.setRows(0); QueryResponse queryResponse = ontologiesSolrServer.query(countQuery); long count = queryResponse.getResults().getNumFound(); return count; }
/** Added overloaded method for specifying field list**/ public SolrDocumentList runQuery(String q, List<String> fieldList, int results) throws SolrServerException { SolrQuery query = new SolrQuery(); query.setQuery(escapeQuery(q)); query.setRows(results); query.setFields(fieldList.toArray(new String[1])); QueryResponse rsp = server.query(query, METHOD.POST); return rsp.getResults(); }
public long countAllDocuments(){ SolrQuery query = new SolrQuery("*:*"); query.setRows(0); try { return solrServer.query(query).getResults().getNumFound(); } catch (SolrServerException e) { throw new IntactSolrException("Problem searching with query: "+query, e); } }
public SolrDocumentList search(final SolrQuery query) throws SolrServerException, IOException { final QueryResponse response = this.getServer().query(query); return response.getResults(); }
/** * @return number of documents in the index * @throws SolrServerException */ public long size() throws SolrServerException { SolrQuery q = new SolrQuery("*:*"); q.setRows(0); return server().query(q).getResults().getNumFound(); }
private ServerDetail fetchServerDetails(String hostname, String coreName, SolrServer realTimeThoth) throws SolrServerException { System.out.println("Fetching server details for hostname("+hostname+") coreName("+coreName+")"); QueryResponse qr = realTimeThoth.query(new SolrQuery("hostname_s:\"" + hostname + "\"" +" AND " + "coreName_s:\"" +coreName + "\" AND NOT exception_b:true AND NOT slowQuery_b:true").setRows(1)); SolrDocumentList solrDocumentList = qr.getResults(); ServerDetail sd = null; if (qr.getResults().getNumFound() > 0) { String pool = (String)solrDocumentList.get(0).getFieldValue(POOL); String port = solrDocumentList.get(0).getFieldValue(PORT).toString(); sd = new ServerDetail(hostname, pool, port, coreName); } return sd; }
public SolrDocumentList runQuery(String q, int results) throws SolrServerException { SolrQuery query = new SolrQuery(); query.setQuery(escapeQuery(q)); query.setRows(results); query.setFields("*", "score"); QueryResponse rsp = server.query(query, METHOD.POST); return rsp.getResults(); }
public long search(final SolrQuery query) throws SolrServerException, IOException { final QueryResponse response = this.getServer().query(query); return response.getResults().getNumFound(); }
SolrServer solr = new CommonsHttpSolrServer("http://localhost:8080/solr"); ModifiableSolrParams params = new ModifiableSolrParams(); params.set("qt", "/spell"); params.set("q", "whatever"); params.set("spellcheck", "on"); //params.set("spellcheck.build", "true"); QueryResponse response = solr.query(params); SpellCheckResponse spellCheckResponse = response.getSpellCheckResponse(); if (!spellCheckResponse.isCorrectlySpelled()) { for (Suggestion suggestion : response.getSpellCheckResponse().getSuggestions()) { logger.debug("original token: " + suggestion.getToken() + " - alternatives: " + suggestion.getAlternatives()); } }