+ ResearcherPageUtils.getPersistentIdentifier(rp),"NOT(withdrawn:true)");
query.setFields("dc.identifier.pmid");
query.setRows(Integer.MAX_VALUE);
QueryResponse response = searchService.search(query);
SolrDocumentList results = response.getResults();
for (SolrDocument doc : results)
{
Integer pmid = null;
try
{
pmid = Integer.valueOf((String) doc
.getFirstValue("dc.identifier.pmid"));
}
catch (NumberFormatException e)
{
log.warn("Found invalid pmid: "
+ doc.getFieldValue("dc.identifier.pmid")
+ " for rp: "
+ ResearcherPageUtils.getPersistentIdentifier(rp));
}
if (pmid != null)
{
PMCCitation pmccitation = pmcService.get(PMCCitation.class,
pmid);
if (pmccitation != null && pmccitation.getNumCitations() > 0)
{
itemsCited++;
citations += pmccitation.getNumCitations();
}
}
}
updated = setValue(applicationService, rp, itemsCitedTP,
String.valueOf(itemsCited));
// caution don't use the short-circuit OR operator (i.e || otherwise
// only the first found pmcdata value will be recorded!)
updated = updated
| setValue(applicationService, rp, citationsTP,
String.valueOf(citations));
updated = updated
| setValue(applicationService, rp, itemsInPubmedTP,
String.valueOf(results.getNumFound()));
if (StringUtils.isNotEmpty(itemsInPMCTP))
{
query = new SolrQuery();
query.setQuery("dc.identifier.pmcid:[* TO *]");
query.addFilterQuery("{!field f=author_authority}"
+ ResearcherPageUtils.getPersistentIdentifier(rp),"NOT(withdrawn:true)");
query.setRows(0);
response = searchService.search(query);
results = response.getResults();
// caution don't use the short-circuit OR operator (i.e || otherwise
// only the first found pmcdata value will be recorded!)
updated = updated
| setValue(applicationService, rp, itemsInPMCTP,
String.valueOf(results.getNumFound()));
}
if (updated)
{
applicationService.saveOrUpdate(ResearcherPage.class, rp);