Examples of CrisSearchService


Examples of org.dspace.app.cris.discovery.CrisSearchService

      HttpServletResponse response) throws ServletException, IOException,
      SQLException {
    Researcher util = new Researcher();

    ApplicationService applicationService = util.getApplicationService();
    CrisSearchService searchService = (CrisSearchService) util
        .getCrisSearchService();
   
   
    String idString = request.getPathInfo();
    String[] pathInfo = idString.split("/", 2);
View Full Code Here

Examples of org.dspace.app.cris.discovery.CrisSearchService

    {

        Researcher util = new Researcher();

        ApplicationService applicationService = util.getApplicationService();
        CrisSearchService searchService = (CrisSearchService) util
                .getCrisSearchService();

       
        Integer objectId = extractEntityId(request);
        if (objectId == -1)
View Full Code Here

Examples of org.dspace.app.cris.discovery.CrisSearchService

            EPerson eperson, List<String> rpkeys, boolean test,
            List<String> relationFields) throws IOException,
            MessagingException, SQLException, SearchServiceException
    {

        CrisSearchService searchService = researcher.getCrisSearchService();

        // Get a resource bundle according to the eperson language preferences
        Locale supportedLocale = I18nUtil.getEPersonLocale(eperson);

        StringBuffer emailText = new StringBuffer();
        boolean isFirst = true;

        for (String rpkey : rpkeys)
        {
            SolrQuery query = new SolrQuery();
            query.setFields("search.resourceid");
            query.addFilterQuery("{!field f=search.resourcetype}"
                    + Constants.ITEM, "{!field f=inarchive}true");

            for (String tmpRelations : relationFields)
            {
                String fq = "{!field f=" + tmpRelations + "}" + rpkey;
                query.addFilterQuery(fq);
            }

            query.setRows(Integer.MAX_VALUE);

            if (ConfigurationManager.getBooleanProperty(
                    "eperson.subscription.onlynew", false))
            {
                // get only the items archived yesterday
                query.setQuery("dateaccessioned:(NOW/DAY-1DAY)");
            }
            else
            {
                // get all item modified yesterday but not published the day
                // before
                // and all the item modified today and archived yesterday
                query.setQuery("(item.lastmodified:(NOW/DAY-1DAY) AND dateaccessioned:(NOW/DAY-1DAY)) OR ((item.lastmodified:(NOW/DAY) AND dateaccessioned:(NOW/DAY-1DAY)))");
            }

            QueryResponse qResponse = searchService.search(query);
            SolrDocumentList results = qResponse.getResults();

            // Only add to buffer if there are new items
            if (results.getNumFound() > 0)
View Full Code Here

Examples of org.dspace.app.cris.discovery.CrisSearchService

        DSpace dspace = new DSpace();
        ApplicationService applicationService = dspace.getServiceManager()
                .getServiceByName("applicationService",
                        ApplicationService.class);

        CrisSearchService searchService = dspace.getServiceManager()
                .getServiceByName(CrisSearchService.class.getName(),
                    CrisSearchService.class);
        PMCPersistenceService pmcService = dspace.getServiceManager()
                .getServiceByName(PMCPersistenceService.class.getName(),
                        PMCPersistenceService.class);

        List<ResearcherPage> rs = applicationService
                .getList(ResearcherPage.class);

        for (ResearcherPage rp : rs)
        {
            boolean updated = false;
            int itemsCited = 0;
            int citations = 0;
            SolrQuery query = new SolrQuery();
            query.setQuery("dc.identifier.pmid:[* TO *]");
            query.addFilterQuery("{!field f=author_authority}"
                    + 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,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.