Search in sources :

Example 1 with OrcidSearchResults

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());
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList) VisibilityControl(org.orcid.core.security.visibility.aop.VisibilityControl)

Example 2 with OrcidSearchResults

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();
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList)

Example 3 with OrcidSearchResults

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;
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSolrResult(org.orcid.utils.solr.entities.OrcidSolrResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 4 with OrcidSearchResults

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;
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSolrResult(org.orcid.utils.solr.entities.OrcidSolrResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidSolrResults(org.orcid.utils.solr.entities.OrcidSolrResults)

Example 5 with OrcidSearchResults

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;
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSolrResult(org.orcid.utils.solr.entities.OrcidSolrResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidSolrResults(org.orcid.utils.solr.entities.OrcidSolrResults)

Aggregations

OrcidSearchResults (org.orcid.jaxb.model.message.OrcidSearchResults)6 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)5 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)5 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)3 OrcidSolrResult (org.orcid.utils.solr.entities.OrcidSolrResult)3 ArrayList (java.util.ArrayList)2 OrcidSolrResults (org.orcid.utils.solr.entities.OrcidSolrResults)2 VisibilityControl (org.orcid.core.security.visibility.aop.VisibilityControl)1 Orcid (org.orcid.jaxb.model.message.Orcid)1 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)1