SearchResultsDaoImpl extends SolrDaoImpl implements SearchResultsDao { @Override public SolrDocumentList getDocuments(SolrQuery query) { QueryResponse queryResponse = fireQuery(query); final SolrDocumentList documents = queryResponse.getResults(); if (documents != null) { logger.debug("Found {} documents", documents.getNumFound()); return documents; } else { logger.warn("Null result for query {}", query); return new SolrDocumentList(); } } SearchResultsDaoImpl(SolrClient solrClient, VloConfig config, FieldNameService fieldNameService); @Override List<FacetField> getFacets(SolrQuery query); @Override SolrDocumentList getDocuments(SolrQuery query); @Override QueryResponse getQueryResponse(SolrQuery query);  }
@Test public void testGetDocuments() { SolrQuery query = new SolrQuery(); query.setRows(10); query.setStart(0); query.setFields(fieldNameService.getFieldName(FieldKey.NAME), fieldNameService.getFieldName(FieldKey.ID), fieldNameService.getFieldName(FieldKey.DESCRIPTION)); { SolrDocumentList documents = instance.getDocuments(query); assertEquals(2, documents.getNumFound()); } query.setQuery(fieldNameService.getFieldName(FieldKey.COUNTRY) + ":\"Another country\""); { SolrDocumentList documents = instance.getDocuments(query); assertEquals(1, documents.getNumFound()); assertEquals("2", documents.get(0).getFieldValue(fieldNameService.getFieldName(FieldKey.ID))); } query.setFilterQueries(fieldNameService.getFieldName(FieldKey.COLLECTION) + ":\"Third collection\""); { SolrDocumentList documents = instance.getDocuments(query); assertEquals(0, documents.getNumFound()); } }