Package org.apache.archiva.indexer.search

Examples of org.apache.archiva.indexer.search.SearchResultLimits


        if ( CollectionUtils.isEmpty(managedRepositoryList) )
        {
            return GlobalResults.ACCESS_TO_NO_REPOS;
        }

        SearchResultLimits limits = new SearchResultLimits(currentPage);
        limits.setPageSize(rowCount);
        List<String> selectedRepos = new ArrayList<String>();

        if ( repositoryId == null || StringUtils.isBlank(repositoryId) || "all".equals(
            StringUtils.stripToEmpty(repositoryId)) )
        {
            selectedRepos = getObservableRepos();
        }
        else
        {
            selectedRepos.add(repositoryId);
        }

        if ( CollectionUtils.isEmpty(selectedRepos) )
        {
            return GlobalResults.ACCESS_TO_NO_REPOS;
        }

        SearchFields searchFields = new SearchFields(groupId, artifactId, version, null, className, selectedRepos);

        if ( StringUtils.isNotBlank(this.bundleExportPackage) )
        {
            searchFields.setBundleExportPackage(this.bundleExportPackage);
        }

        if ( StringUtils.isNotBlank(this.bundleExportService) )
        {
            searchFields.setBundleExportService(this.bundleExportService);
        }

        if ( StringUtils.isNotBlank(this.bundleImportPackage) )
        {
            searchFields.setBundleImportPackage(this.bundleImportPackage);
        }

        if ( StringUtils.isNotBlank(this.bundleSymbolicName) )
        {
            searchFields.setBundleSymbolicName(this.bundleSymbolicName);
        }

        if ( StringUtils.isNotBlank(this.bundleName) )
        {
            searchFields.setBundleName(this.bundleName);
        }

        if ( StringUtils.isNotBlank(this.bundleVersion) )
        {
            searchFields.setBundleVersion(this.bundleVersion);
        }

        log.debug("filteredSearch with searchFields {}", searchFields);

        // TODO: add packaging in the list of fields for advanced search (UI)?
        try
        {
            results = getNexusSearch().search(getPrincipal(), searchFields, limits);
        }
        catch ( RepositorySearchException e )
        {
            addActionError(e.getMessage());
            return ERROR;
        }

        if ( results.isEmpty() )
        {
            addActionError("No results found");
            return INPUT;
        }

        totalPages = results.getTotalHits() / limits.getPageSize();

        if ( ( results.getTotalHits() % limits.getPageSize() ) != 0 )
        {
            totalPages = totalPages + 1;
        }

        for ( SearchResultHit hit : results.getHits() )
View Full Code Here


        assert q != null && q.length() != 0;

        fromFilterSearch = false;

        SearchResultLimits limits = new SearchResultLimits(currentPage);

        List<String> selectedRepos = getObservableRepos();
        if ( CollectionUtils.isEmpty(selectedRepos) )
        {
            return GlobalResults.ACCESS_TO_NO_REPOS;
        }

        log.debug("quickSearch with selectedRepos {} query {}", selectedRepos, q);

        try
        {
            if ( searchResultsOnly && !completeQueryString.equals("") )
            {
                results = getNexusSearch().search(getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString());
            }
            else
            {
                completeQueryString = "";
                results = getNexusSearch().search(getPrincipal(), selectedRepos, q, limits, null);
            }
        }
        catch ( RepositorySearchException e )
        {
            addActionError(e.getMessage());
            return ERROR;
        }

        if ( results.isEmpty() )
        {
            addActionError("No results found");
            return INPUT;
        }

        totalPages = results.getTotalHitsMapSize() / limits.getPageSize();

        if ( ( results.getTotalHitsMapSize() % limits.getPageSize() ) != 0 )
        {
            totalPages = totalPages + 1;
        }

        if ( !isEqualToPreviousSearchTerm(q) )
View Full Code Here

        if ( StringUtils.isBlank( queryString ) )
        {
            return Collections.emptyList();
        }

        SearchResultLimits limits = new SearchResultLimits( 0 );
        List<String> observableRepoIds = getObservableRepos();
        try
        {
            SearchResults searchResults =
                repositorySearch.search( getPrincipal(), getObservableRepos(), queryString, limits,
View Full Code Here

        if ( searchRequest == null )
        {
            return Collections.emptyList();
        }
        SearchFields searchField = new BeanReplicator().replicateBean( searchRequest, SearchFields.class );
        SearchResultLimits limits = new SearchResultLimits( 0 );

        // if no repos set we use ones available for the user
        if ( searchField.getRepositories() == null || searchField.getRepositories().isEmpty() )
        {
            searchField.setRepositories( getObservableRepos() );
View Full Code Here

        List<String> selectedRepos = new ArrayList<String>();
        selectedRepos.add("internal");
        selectedRepos.add("snapshots");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResultHit hit = new SearchResultHit();
        hit.setGroupId("org.apache.archiva");
        hit.setArtifactId("archiva-configuration");
        hit.setUrl("url");
View Full Code Here

        List<String> selectedRepos = new ArrayList<String>();
        selectedRepos.add("internal");
        selectedRepos.add("snapshots");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResultHit hit = new SearchResultHit();
        hit.setGroupId("org.apache.archiva");
        hit.setArtifactId("archiva-configuration");
        hit.setUrl("url");
View Full Code Here

        List<String> selectedRepos = new ArrayList<String>();
        selectedRepos.add("internal");
        selectedRepos.add("snapshots");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResults results = new SearchResults();

        userReposControl.expectAndReturn(userRepos.getObservableRepositoryIds("user"), selectedRepos);
View Full Code Here

        action.setManagedRepositoryList(managedRepos);
        action.setCurrentPage(0);
        action.setRowCount(30);
        action.setGroupId("org");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResultHit hit = new SearchResultHit();
        hit.setGroupId("org.apache.archiva");
        hit.setArtifactId("archiva-configuration");
        hit.setUrl("url");
View Full Code Here

        action.setManagedRepositoryList(managedRepos);
        action.setCurrentPage(0);
        action.setRowCount(30);
        action.setGroupId("org");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResultHit hit = new SearchResultHit();
        hit.setGroupId("org.apache.archiva");
        hit.setArtifactId("archiva-configuration");
        hit.setUrl("url");
View Full Code Here

        action.setManagedRepositoryList(managedRepos);
        action.setCurrentPage(0);
        action.setRowCount(30);
        action.setGroupId("org");

        SearchResultLimits limits = new SearchResultLimits(action.getCurrentPage());
        limits.setPageSize(30);

        SearchResults results = new SearchResults();

        List<String> selectedRepos = new ArrayList<String>();
        selectedRepos.add("internal");
View Full Code Here

TOP

Related Classes of org.apache.archiva.indexer.search.SearchResultLimits

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.