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;
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method multipleResultsForQuery.
private OrcidSolrResults multipleResultsForQuery() {
OrcidSolrResults orcidSolrResults = new OrcidSolrResults();
List<OrcidSolrResult> resultsList = new ArrayList<>();
orcidSolrResults.setResults(resultsList);
resultsList.add(getOrcidSolrResult("5678", new Float(37.2)));
resultsList.add(getOrcidSolrResult("6789", new Float(52.2)));
orcidSolrResults.setNumFound(2);
return orcidSolrResults;
}
use of org.orcid.utils.solr.entities.OrcidSolrResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method testFindOrcidIdsNoResults.
@Test
public void testFindOrcidIdsNoResults() {
when(mockSolrDao.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 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;
}
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;
}
Aggregations