List of usage examples for org.apache.solr.client.solrj SolrResponse getResponse
public abstract NamedList<Object> getResponse();
From source file:fr.cnes.sitools.thesaurus.ThesaurusIndexer.java
License:Open Source License
private String getStatus(SolrResponse response) { Object statusObj = response.getResponse().get("status"); if (statusObj != null) { String status = statusObj.toString(); return status; } else {/*from w ww . ja va 2 s .c om*/ return null; } }
From source file:org.apache.ranger.services.solr.client.ServiceSolrClient.java
License:Apache License
public List<String> getCollectionList(List<String> ignoreCollectionList) throws Exception { if (!isSolrCloud) { return getCoresList(ignoreCollectionList); }//from w w w . j ava2s.c om CollectionAdminRequest<?> request = new CollectionAdminRequest.List(); SolrResponse response = request.process(solrClient); List<String> list = new ArrayList<String>(); for (int i = 0; i < response.getResponse().size(); i++) { if (ignoreCollectionList == null || !ignoreCollectionList.contains(list.get(i))) { list.add(list.get(i)); } } return list; }
From source file:org.craftercms.search.service.impl.SolrSearchService.java
License:Open Source License
@Override public Map<String, Object> search(String indexId, SolrQuery query) throws SearchException { if (StringUtils.isEmpty(indexId)) { indexId = defaultIndexId;//from w w w. j ava 2 s. c o m } addAdditionalFilterQueries(indexId, query); if (logger.isDebugEnabled()) { logger.debug("{}Executing query {}", getIndexPrefix(indexId), query); } SolrResponse response; try { response = solrClient.query(indexId, toActualSolrQuery(query)); } catch (SolrServerException | IOException e) { throw new SearchException(indexId, "Search for query " + query + " failed", e); } // Solr search result is a List<Map.Entry<String,Object>>, where every entry is a (name,value) pair, // and there can be duplicate names in the list. NamedList<Object> list = response.getResponse(); // Convert this list into a map where values of the same name are grouped into a list. Map<String, Object> map = toMap(list); if (logger.isDebugEnabled()) { logger.debug("{}Response for query {}: {}", getIndexPrefix(indexId), query, map); } return map; }