use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method testFindOrcidIdsNoResults.
@Test
public void testFindOrcidIdsNoResults() {
when(solrDao.findByDocumentCriteria(Matchers.<Map<String, List<String>>>any())).thenReturn(new OrcidSolrResults());
Search search = orcidSearchManager.findOrcidIds(new HashMap<>());
assertNotNull(search);
assertEquals(Long.valueOf(0), search.getNumFound());
assertEquals(0, search.getResults().size());
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class SolrDaoTest method queryStringSearchPatent.
@Test
public void queryStringSearchPatent() throws Exception {
OrcidSolrDocument firstOrcid = buildAndPersistFirstOrcid();
String patentQueryString = "patent-numbers:Elec-hammer01X%3A";
OrcidSolrResults orcidSolrResults = solrDao.findByDocumentCriteria(patentQueryString, null, null);
List<OrcidSolrResult> solrResultsList = orcidSolrResults.getResults();
assertTrue(solrResultsList.size() == 1);
assertEquals(firstOrcid.getOrcid(), solrResultsList.get(0).getOrcid());
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImpl method findOrcidsByQuery.
@Override
public OrcidMessage findOrcidsByQuery(String query, Integer start, Integer rows) {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidSearchResults searchResults = new OrcidSearchResults();
OrcidSolrResults orcidSolrResults = solrDao.findByDocumentCriteria(query, start, rows);
searchResults.setNumFound(orcidSolrResults.getNumFound());
List<OrcidSolrResult> indexedOrcids = orcidSolrResults.getResults();
if (indexedOrcids != null && !indexedOrcids.isEmpty()) {
List<OrcidSearchResult> orcidSearchResults = buildSearchResultsFromPublicProfile(indexedOrcids);
searchResults.getOrcidSearchResult().addAll(orcidSearchResults);
}
orcidMessage.setOrcidSearchResults(searchResults);
return orcidMessage;
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImpl method findOrcidsByQuery.
@Override
public OrcidMessage findOrcidsByQuery(Map<String, List<String>> query) {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidSearchResults searchResults = new OrcidSearchResults();
OrcidSolrResults orcidSolrResults = solrDao.findByDocumentCriteria(query);
searchResults.setNumFound(orcidSolrResults.getNumFound());
List<OrcidSolrResult> indexedOrcids = orcidSolrResults.getResults();
if (indexedOrcids != null && !indexedOrcids.isEmpty()) {
List<OrcidSearchResult> orcidSearchResults = buildSearchResultsFromPublicProfile(indexedOrcids);
searchResults.getOrcidSearchResult().addAll(orcidSearchResults);
}
orcidMessage.setOrcidSearchResults(searchResults);
return orcidMessage;
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImpl method findOrcidIds.
@Override
public Search findOrcidIds(Map<String, List<String>> queryParameters) {
Search search = new Search();
OrcidSolrResults orcidSolrResults = solrDao.findByDocumentCriteria(queryParameters);
if (orcidSolrResults != null && orcidSolrResults.getResults() != null) {
List<Result> orcidIdList = orcidSolrResults.getResults().stream().map(r -> {
Result result = new Result();
result.setOrcidIdentifier(recordManagerReadOnly.getOrcidIdentifier(r.getOrcid()));
return result;
}).collect(Collectors.toList());
search.getResults().addAll(orcidIdList);
search.setNumFound(orcidSolrResults.getNumFound());
} else {
search.setNumFound(0L);
}
return search;
}
Aggregations