use of org.orcid.jaxb.model.message.OrcidSearchResults in project ORCID-Source by ORCID.
the class OrcidApiServiceDelegatorImpl method searchByQuery.
/**
* See {@link OrcidApiServiceDelegator}{@link #searchByQuery(Map)}
*/
@Override
@VisibilityControl
public Response searchByQuery(Map<String, List<String>> queryMap) {
validateSearchParams(queryMap);
OrcidMessage orcidMessage = orcidSearchManager.findOrcidsByQuery(queryMap);
List<OrcidSearchResult> searchResults = orcidMessage.getOrcidSearchResults() != null ? orcidMessage.getOrcidSearchResults().getOrcidSearchResult() : null;
List<OrcidSearchResult> filteredResults = new ArrayList<OrcidSearchResult>();
OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
if (searchResults != null) {
orcidSearchResults.setNumFound(orcidMessage.getOrcidSearchResults().getNumFound());
if (searchResults.size() > 0) {
for (OrcidSearchResult searchResult : searchResults) {
OrcidSearchResult filteredSearchResult = new OrcidSearchResult();
OrcidProfile filteredProfile = new OrcidProfile();
filteredSearchResult.setRelevancyScore(searchResult.getRelevancyScore());
filteredProfile.setOrcid(searchResult.getOrcidProfile().getOrcid());
filteredProfile.setOrcidId(searchResult.getOrcidProfile().getOrcidId());
filteredProfile.setOrcidIdentifier(searchResult.getOrcidProfile().getOrcidIdentifier());
filteredProfile.setOrcidBio(searchResult.getOrcidProfile().getOrcidBio());
filteredSearchResult.setOrcidProfile(filteredProfile);
filteredResults.add(filteredSearchResult);
}
}
}
orcidSearchResults.getOrcidSearchResult().addAll(filteredResults);
return getOrcidSearchResultsResponse(orcidSearchResults, queryMap.toString());
}
use of org.orcid.jaxb.model.message.OrcidSearchResults in project ORCID-Source by ORCID.
the class T1OrcidApiServiceImplLatestMetricsTest method orcidWithMultipleResults.
private Response orcidWithMultipleResults() {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidProfile orcidProfile1 = new OrcidProfile();
OrcidProfile orcidProfile2 = new OrcidProfile();
OrcidProfile orcidProfile3 = new OrcidProfile();
OrcidSearchResult orcidSearchResult1 = new OrcidSearchResult();
OrcidSearchResult orcidSearchResult2 = new OrcidSearchResult();
OrcidSearchResult orcidSearchResult3 = new OrcidSearchResult();
orcidSearchResult1.setOrcidProfile(orcidProfile1);
orcidSearchResult2.setOrcidProfile(orcidProfile2);
orcidSearchResult3.setOrcidProfile(orcidProfile3);
List<OrcidSearchResult> searchResults = new ArrayList<OrcidSearchResult>();
searchResults.add(orcidSearchResult1);
searchResults.add(orcidSearchResult2);
searchResults.add(orcidSearchResult3);
OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
orcidSearchResults.getOrcidSearchResult().addAll(searchResults);
orcidMessage.setOrcidSearchResults(orcidSearchResults);
return Response.ok(orcidMessage).build();
}
use of org.orcid.jaxb.model.message.OrcidSearchResults in project ORCID-Source by ORCID.
the class OrcidSearchManagerImpl method findOrcidSearchResultsById.
@Override
public OrcidMessage findOrcidSearchResultsById(String orcid) {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidSearchResults searchResults = new OrcidSearchResults();
OrcidSolrResult indexedOrcid = solrDao.findByOrcid(orcid);
if (indexedOrcid != null) {
List<OrcidSearchResult> orcidSearchResults = buildSearchResultsFromPublicProfile(Arrays.asList(indexedOrcid));
searchResults.getOrcidSearchResult().addAll(orcidSearchResults);
}
orcidMessage.setOrcidSearchResults(searchResults);
searchResults.setNumFound(1);
return orcidMessage;
}
use of org.orcid.jaxb.model.message.OrcidSearchResults 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.jaxb.model.message.OrcidSearchResults 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;
}
Aggregations