Package org.dspace.discovery

Examples of org.dspace.discovery.DiscoverResult


    {
        ACrisObject cris = getCrisObject(request);
        Context c = UIUtil.obtainContext(request);
        List<String[]> subLinks = new ArrayList<String[]>();

        DiscoverResult docs = search(c, cris, 0, 0, null, true);
        if (docs.getTotalSearchResults() > 0)
        {
            for (String type : docs.getFacetResults().keySet())
            {
                Long size = docs.getFacetResults().get(type).get(0).getCount();
                String message = "";
                try
                {
                    message = I18nUtil.getMessage(
                            "jsp.layout.dspace.detail.fieldset-legend.component."
View Full Code Here


        int etAl = -1;
        String orderfield = "";
        boolean ascending = false;

        Context context = UIUtil.obtainContext(request);
        DiscoverResult docs = null;
        long docsNumFound = 0;

        if (types.keySet().contains(type))
        {
            start = UIUtil.getIntParameter(request,
                    "start" + getTypes().get(type).getComponentIdentifier());
            // can't start earlier than 0 in the results!
            if (start < 0)
            {
                start = 0;
            }
            sortBy = getSortBy(request, type);
            order = getOrder(request, type);
            rpp = getRPP(request, type);
            etAl = getEtAl(request, type);
            orderfield = sortBy != -1 ? "bi_sort_" + sortBy + "_sort" : null;
            ascending = SortOption.ASCENDING.equalsIgnoreCase(order);

            // Perform the search

            docs = search(context, type, cris, start, rpp, orderfield,
                    ascending);
            if (docs != null)
            {
                docsNumFound = docs.getTotalSearchResults();
            }
        }

        if ((docs == null || docsNumFound == 0) && activeTypes.size() > 0)
        {
            type = activeTypes.get(0)[0];
            sortBy = getSortBy(request, type);
            order = getOrder(request, type);
            rpp = getRPP(request, type);
            etAl = getEtAl(request, type);
            orderfield = sortBy != -1 ? "bi_sort_" + sortBy + "_sort" : null;
            ascending = SortOption.ASCENDING.equalsIgnoreCase(order);
            docs = search(context, type, cris, start, rpp, orderfield,
                    ascending);
            if (docs != null)
            {
                docsNumFound = docs.getTotalSearchResults();
            }
        }

        // Pass in some page qualities
        // total number of pages
View Full Code Here

                                + ") OR (\""
                                + luceneQuery.substring(0,
                                        luceneQuery.length() - 1) + "\")");
               
                discoverQuery.setMaxResults(50);
                DiscoverResult result = searchService.search(null,
                        discoverQuery, true);

                List<Choice> choiceList = new ArrayList<Choice>();

                for (DSpaceObject dso : result.getDspaceObjects())
                {
                    ACrisObject cris = (ACrisObject) dso;
                    choiceList.add(new Choice(ResearcherPageUtils
                            .getPersistentIdentifier(cris), cris.getName(),
                            cris.getName()));
View Full Code Here

                                + luceneQuery
                                + ") OR (\""
                                + luceneQuery.substring(0,
                                        luceneQuery.length() - 1) + "\")");
                discoverQuery.setMaxResults(50);
                DiscoverResult result = searchService.search(null,
                        discoverQuery, true);

                List<Choice> choiceList = new ArrayList<Choice>();

                for (DSpaceObject dso : result.getDspaceObjects())
                {
                    ResearcherPage rp = (ResearcherPage) dso;
                    choiceList
                            .add(new Choice(ResearcherPageUtils
                                    .getPersistentIdentifier(rp), rp
View Full Code Here

                discoverQuery
                        .setQuery("{!lucene q.op=AND df=crisauthoritylookup}\""
                                + ClientUtils.escapeQueryChars(text.trim())
                                + "\"");
                discoverQuery.setMaxResults(50);
                DiscoverResult result = searchService.search(null,
                        discoverQuery, true);
                totalResult = (int) result.getTotalSearchResults();
                for (DSpaceObject dso : result.getDspaceObjects())
                {
                    ResearcherPage rp = (ResearcherPage) dso;
                    choiceList
                            .add(new Choice(rp.getCrisID(), text,
                                    ResearcherPageUtils.getLabel(
View Full Code Here

                        queryArgs.setSortField(sortField, DiscoverQuery.SORT_ORDER.asc);
                    else
                        queryArgs.setSortField(sortField, DiscoverQuery.SORT_ORDER.desc);
                }

                DiscoverResult queryResults = null;
                if(scope == null)
                    queryResults = SearchUtils.getSearchService().search(context, queryArgs);
                else
                    queryResults = SearchUtils.getSearchService().search(context, scope, queryArgs);

              // creates the results array and generates the OpenSearch result
              DSpaceObject[] results = new DSpaceObject[queryResults.getDspaceObjects().size()];
              queryResults.getDspaceObjects().toArray(results);
             
              resultsDoc = OpenSearch.getResultsDoc(format, query, (int) queryResults.getTotalSearchResults(), start, rpp, scope, results, FeedUtils.i18nLabels);
                FeedUtils.unmangleI18N(resultsDoc);
            }

            // Send the SAX events
            DOMStreamer streamer = new DOMStreamer(contentHandler, lexicalHandler);
View Full Code Here

            HttpServletResponse response, DSpaceObject scope)
    {
        DiscoverQuery queryArgs = DiscoverUtility.getTagCloudDiscoverQuery(context,
                request, scope, true);
        queryArgs.setMaxResults(0);
        DiscoverResult qResults;
        try
        {
            qResults = SearchUtils.getSearchService().search(context, scope,
                    queryArgs);
            request.setAttribute("tagcloud.fresults",
                    qResults.getFacetResults());
            DiscoveryConfiguration discoveryConfiguration = SearchUtils
                    .getDiscoveryConfiguration(scope);
            List<DiscoverySearchFilterFacet> availableFacet = discoveryConfiguration
                    .getTagCloudFacetConfiguration().getTagCloudFacets();
           
View Full Code Here

                            // top
                            yearRangeQuery.setSortField(dateFacet + "_sort",
                                    DiscoverQuery.SORT_ORDER.asc);
                            yearRangeQuery.addFilterQueries(filterQueries);
                            yearRangeQuery.addSearchField(dateFacet);
                            DiscoverResult lastYearResult = SearchUtils
                                    .getSearchService().search(context, scope,
                                            yearRangeQuery);

                            if (0 < lastYearResult.getDspaceObjects().size())
                            {
                                java.util.List<DiscoverResult.SearchDocument> searchDocuments = lastYearResult
                                        .getSearchDocument(lastYearResult
                                                .getDspaceObjects().get(0));
                                if (0 < searchDocuments.size()
                                        && 0 < searchDocuments
                                                .get(0)
                                                .getSearchFieldValues(dateFacet)
                                                .size())
                                {
                                    oldestYear = Integer
                                            .parseInt(searchDocuments
                                                    .get(0)
                                                    .getSearchFieldValues(
                                                            dateFacet).get(0));
                                }
                            }
                            // Now get the first year
                            yearRangeQuery.setSortField(dateFacet + "_sort",
                                    DiscoverQuery.SORT_ORDER.desc);
                            DiscoverResult firstYearResult = SearchUtils
                                    .getSearchService().search(context, scope,
                                            yearRangeQuery);
                            if (0 < firstYearResult.getDspaceObjects().size())
                            {
                                java.util.List<DiscoverResult.SearchDocument> searchDocuments = firstYearResult
                                        .getSearchDocument(firstYearResult
                                                .getDspaceObjects().get(0));
                                if (0 < searchDocuments.size()
                                        && 0 < searchDocuments
                                                .get(0)
                                                .getSearchFieldValues(dateFacet)
View Full Code Here

            HttpServletResponse response, DSpaceObject scope)
    {
        DiscoverQuery queryArgs = DiscoverUtility.getDiscoverQuery(context,
                request, scope, true);
        queryArgs.setMaxResults(0);
        DiscoverResult qResults;
        try
        {
            qResults = SearchUtils.getSearchService().search(context, scope,
                    queryArgs);
            request.setAttribute("discovery.fresults",
                    qResults.getFacetResults());
            DiscoveryConfiguration discoveryConfiguration = SearchUtils
                    .getDiscoveryConfiguration(scope);
            List<DiscoverySearchFilterFacet> availableFacet = discoveryConfiguration
                    .getSidebarFacets();
           
View Full Code Here

        DiscoverQuery queryArgs = DiscoverUtility.getDiscoverQuery(context,
                request, container, false);
        String query = queryArgs.getQuery();

        // Perform the search
        DiscoverResult qResults = null;
        try
        {
            qResults = SearchUtils.getSearchService().search(context,
                    container, queryArgs);
        }
        catch (SearchServiceException e)
        {
            log.error(
                    LogManager.getHeader(context, "opensearch", "query="
                            + queryArgs.getQuery() + ",scope=" + scope
                            + ",error=" + e.getMessage()), e);
            throw new RuntimeException(e.getMessage(), e);
        }

        // Log
        log.info(LogManager.getHeader(context, "opensearch",
                "scope=" + scope + ",query=\"" + query + "\",results=("
                        + qResults.getTotalSearchResults() + ")"));

        // format and return results
        Map<String, String> labelMap = getLabels(request);
        DSpaceObject[] dsoResults = new DSpaceObject[qResults
                .getDspaceObjects().size()];
        qResults.getDspaceObjects().toArray(dsoResults);
        Document resultsDoc = OpenSearch.getResultsDoc(format, query,
                (int)qResults.getTotalSearchResults(), qResults.getStart(),
                qResults.getMaxResults(), container, dsoResults, labelMap);
        try
        {
            Transformer xf = TransformerFactory.newInstance().newTransformer();
            response.setContentType(OpenSearch.getContentType(format));
            xf.transform(new DOMSource(resultsDoc),
View Full Code Here

TOP

Related Classes of org.dspace.discovery.DiscoverResult

Copyright © 2018 www.massapicom. 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.