Search in sources :

Example 26 with OrcidSolrResult

use of org.orcid.utils.solr.entities.OrcidSolrResult 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;
}
Also used : OrcidSolrResult(org.orcid.utils.solr.entities.OrcidSolrResult) ArrayList(java.util.ArrayList) OrcidSolrResults(org.orcid.utils.solr.entities.OrcidSolrResults)

Example 27 with OrcidSolrResult

use of org.orcid.utils.solr.entities.OrcidSolrResult 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 28 with OrcidSolrResult

use of org.orcid.utils.solr.entities.OrcidSolrResult in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method invalidRecordSearchResult.

private OrcidSolrResults invalidRecordSearchResult() {
    OrcidSolrResults orcidSolrResults = new OrcidSolrResults();
    List<OrcidSolrResult> resultsList = new ArrayList<>();
    orcidSolrResults.setResults(resultsList);
    resultsList.add(getOrcidSolrResult("0000", new Float(37.2)));
    orcidSolrResults.setNumFound(2);
    return orcidSolrResults;
}
Also used : OrcidSolrResult(org.orcid.utils.solr.entities.OrcidSolrResult) ArrayList(java.util.ArrayList) OrcidSolrResults(org.orcid.utils.solr.entities.OrcidSolrResults)

Aggregations

OrcidSolrResult (org.orcid.utils.solr.entities.OrcidSolrResult)28 OrcidSolrResults (org.orcid.utils.solr.entities.OrcidSolrResults)13 OrcidSolrDocument (org.orcid.utils.solr.entities.OrcidSolrDocument)11 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)9 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)8 OrcidSearchResults (org.orcid.jaxb.model.message.OrcidSearchResults)6 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 Reader (java.io.Reader)2 Date (java.util.Date)2 SolrQuery (org.apache.solr.client.solrj.SolrQuery)2 SolrServerException (org.apache.solr.client.solrj.SolrServerException)2 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)2 SolrDocument (org.apache.solr.common.SolrDocument)2 DeactivatedException (org.orcid.core.exception.DeactivatedException)2 OrcidDeprecatedException (org.orcid.core.exception.OrcidDeprecatedException)2 OrcidSearchException (org.orcid.core.exception.OrcidSearchException)2 LockedException (org.orcid.core.security.aop.LockedException)2