Package org.apache.maven.index

Examples of org.apache.maven.index.FlatSearchRequest


        indexer.scan( context2 );

        context1.merge( indexDir2 );

        Query q = new TermQuery( new Term( ArtifactInfo.SHA1, "b5e9d009320d11b9859c15d3ad3603b455fa1c85" ) );
        FlatSearchRequest request = new FlatSearchRequest( q, context1 );
        FlatSearchResponse response = indexer.searchFlat( request );

        Set<ArtifactInfo> results = response.getResults();
        ArtifactInfo artifactInfo = results.iterator().next();
        assertEquals( artifactInfo.artifactId, "dma.integration.tests" );
View Full Code Here


        throws Exception
    {
        // Since 4.0 the original query become illegal
        // Query q = nexusIndexer.constructQuery( MAVEN.GROUP_ID, "*", SearchType.SCORED );
        Query q = nexusIndexer.constructQuery( MAVEN.GROUP_ID, "org.maven.ide", SearchType.SCORED );
        FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( q ) );
        Collection<ArtifactInfo> r = response.getResults();

        assertEquals( 1, r.size() );

        List<ArtifactInfo> list = new ArrayList<ArtifactInfo>( r );
View Full Code Here

    {
        assertEquals( 31, context.getSize() );

        {
            Query q = nexusIndexer.constructQuery( MAVEN.GROUP_ID, "qdox", SearchType.SCORED );
            FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( q ) );
            assertEquals( response.getResults().toString(), 2, response.getTotalHits() );

            List<ArtifactInfo> list = new ArrayList<ArtifactInfo>( response.getResults() );
            assertEquals( 2, list.size() );

            {
                ArtifactInfo ai = list.get( 0 );
                assertEquals( "1.6.1", ai.version );
                assertEquals( "jar", ai.fextension );
                assertEquals( "jar", ai.packaging );
            }
            {
                ArtifactInfo ai = list.get( 1 );
                assertEquals( "1.5", ai.version );
                assertEquals( "jar", ai.fextension );
                assertEquals( "jar", ai.packaging );
            }
        }
        {
            Query query = new TermQuery( new Term( ArtifactInfo.PACKAGING, "tar.gz" ) );
            FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( query ) );
            assertEquals( response.getResults().toString(), 1, response.getTotalHits() );

            ArtifactInfo ai = response.getResults().iterator().next();
            assertEquals( "tar.gz", ai.packaging );
            assertEquals( "tar.gz", ai.fextension );
        }
        {
            Query query = new TermQuery( new Term( ArtifactInfo.PACKAGING, "zip" ) );
            FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( query ) );
            assertEquals( response.getResults().toString(), 1, response.getTotalHits() );

            ArtifactInfo ai = response.getResults().iterator().next();
            assertEquals( "zip", ai.packaging );
            assertEquals( "zip", ai.fextension );
View Full Code Here

    @Override
    public void testSearchFlatPaged()
        throws Exception
    {
        FlatSearchRequest request = new FlatSearchRequest( nexusIndexer.constructQuery( MAVEN.GROUP_ID, "org", SearchType.SCORED ) );

        // See MINDEXER-22
        // Flat search is not pageable
        // request.setStart( 0 );

        request.setCount( 50 );

        FlatSearchResponse response = nexusIndexer.searchFlat( request );

        assertEquals( response.getResults().toString(), 15, response.getTotalHits() );
    }
View Full Code Here

    public void testPurge()
        throws Exception
    {
        // we have 14 artifact for this search
        Query q = nexusIndexer.constructQuery( MAVEN.GROUP_ID, "org", SearchType.SCORED );
        FlatSearchRequest request = new FlatSearchRequest( q );

        FlatSearchResponse response1 = nexusIndexer.searchFlat( request );
        Collection<ArtifactInfo> p1 = response1.getResults();

        assertEquals( 15, p1.size() );
View Full Code Here

                            if ( ac.getArtifactInfo().packaging != null )
                            {
                                q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
                                    ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
                            }
                            FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
                            FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
                            if ( flatSearchResponse.getResults().isEmpty() )
                            {
                                log.debug( "Adding artifact '{}' to index..", ac.getArtifactInfo() );
                                nexusIndexer.addArtifactToIndex( ac, context );
View Full Code Here

        // search
        BooleanQuery iQuery = new BooleanQuery();
        iQuery.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "commons-logging" ) ),
                    BooleanClause.Occur.SHOULD );

        FlatSearchRequest rq = new FlatSearchRequest( iQuery );
        rq.setContexts(
            Arrays.asList( nexusIndexer.getIndexingContexts().get( "remote-" + getRemoteRepository().getId() ) ) );

        FlatSearchResponse response = nexusIndexer.searchFlat( rq );

        log.info( "returned hit count:{}", response.getReturnedHitsCount() );
View Full Code Here

                            if ( ac.getArtifactInfo().packaging != null )
                            {
                                q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
                                    ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
                            }
                            FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
                            FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
                            if ( flatSearchResponse.getResults().isEmpty() )
                            {
                                log.debug( "Adding artifact '{}' to index..", ac.getArtifactInfo() );
                                nexusIndexer.addArtifactToIndex( ac, context );
View Full Code Here

        throws RepositorySearchException
    {

        try
        {
            FlatSearchRequest request = new FlatSearchRequest(q);
            request.setContexts(getIndexingContexts(indexingContextIds));

            FlatSearchResponse response = indexer.searchFlat(request);

            if ( response == null || response.getTotalHits() == 0 )
            {
View Full Code Here

                                                                            ".indexer" ), null, null,
                                                                  mavenIndexerUtils.getAllIndexCreators() );
            context.setSearchable( true );
        }

        FlatSearchRequest request = new FlatSearchRequest( q );
        FlatSearchResponse response = indexer.searchFlat( request );

        assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
        assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
        assertEquals( 1, response.getTotalHits() );
View Full Code Here

TOP

Related Classes of org.apache.maven.index.FlatSearchRequest

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.