Package org.apache.maven.index.expr

Examples of org.apache.maven.index.expr.StringSearchExpression


                                      getIndexingContext() );

        indexingExecutor.executeTask( task );

        BooleanQuery q = new BooleanQuery();
        q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
               Occur.SHOULD );
        q.add(
            indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
            Occur.SHOULD );

        if ( !indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ) )
        {
            IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
View Full Code Here


        indexingExecutor.executeTask( task );
        indexingExecutor.executeTask( task );

        BooleanQuery q = new BooleanQuery();
        q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
               Occur.SHOULD );
        q.add(
            indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
            Occur.SHOULD );

        IndexingContext ctx = indexer.getIndexingContexts().get( repositoryConfig.getId() );

        IndexSearcher searcher = ctx.acquireIndexSearcher();
View Full Code Here

        // unpack .zip index
        File destDir = new File( repositoryConfig.getLocation(), ".indexer/tmp" );
        unzipIndex( indexerDirectory.getPath(), destDir.getPath() );

        BooleanQuery q = new BooleanQuery();
        q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
               Occur.SHOULD );
        q.add(
            indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
            Occur.SHOULD );

        FlatSearchRequest request = new FlatSearchRequest( q, getIndexingContext() );
        FlatSearchResponse response = indexer.searchFlat( request );
View Full Code Here

        remoteRepositoryAdmin.deleteRemoteRepository( "test-repo", null );

        // 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() ) ) );
View Full Code Here

        try
        {
            BooleanQuery q = new BooleanQuery();

            q.add( nexusIndexer.constructQuery( OSGI.SYMBOLIC_NAME,
                                                new StringSearchExpression( "org.apache.karaf.features.command" ) ),
                   BooleanClause.Occur.MUST );

            FlatSearchRequest request = new FlatSearchRequest( q );
            assertEquals( 2, nexusIndexer.getIndexingContexts().values().size() );
            request.setContexts( Arrays.asList( nexusIndexer.getIndexingContexts().get( INDEX_ID2 ),
                                                nexusIndexer.getIndexingContexts().get( INDEX_ID1 ) ) );

            FlatSearchResponse response = nexusIndexer.searchFlat( request );

            assertEquals( 1, response.getResults().size() );

            q = new BooleanQuery();

            q.add( nexusIndexer.constructQuery( OSGI.SYMBOLIC_NAME,
                                                new StringSearchExpression( "org.apache.karaf.features.core" ) ),
                   BooleanClause.Occur.MUST );

            request = new FlatSearchRequest( q );
            request.setContexts( new ArrayList( nexusIndexer.getIndexingContexts().values() ) );

            response = nexusIndexer.searchFlat( request );

            assertEquals( 2, response.getResults().size() );

            String term = "org.apache.karaf.features";

            q = new BooleanQuery();

            q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( term ) ),
                   BooleanClause.Occur.SHOULD );
            q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( term ) ),
                   BooleanClause.Occur.SHOULD );
            q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new StringSearchExpression( term ) ),
                   BooleanClause.Occur.SHOULD );
            q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new StringSearchExpression( term ) ),
                   BooleanClause.Occur.SHOULD );
            q.add( nexusIndexer.constructQuery( MAVEN.CLASSNAMES, new StringSearchExpression( term ) ),
                   BooleanClause.Occur.SHOULD );

            request = new FlatSearchRequest( q );
            request.setContexts( new ArrayList( nexusIndexer.getIndexingContexts().values() ) );
View Full Code Here

        try
        {
            BooleanQuery q = new BooleanQuery();

            q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "commons-cli" ) ),
                   BooleanClause.Occur.MUST );

            q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new StringSearchExpression( "jar" ) ),
                   BooleanClause.Occur.MUST );

            q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new StringSearchExpression( "sources" ) ),
                   BooleanClause.Occur.MUST );

            FlatSearchRequest request = new FlatSearchRequest( q );
            assertEquals( 2, nexusIndexer.getIndexingContexts().values().size() );
            request.setContexts( Arrays.asList( nexusIndexer.getIndexingContexts().get( INDEX_ID2 ),
View Full Code Here

        remoteRepositoryAdmin.deleteRemoteRepository( "test-repo", null );

        // 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() ) ) );
View Full Code Here

        }

        BooleanQuery q = new BooleanQuery();
        if ( StringUtils.isNotBlank(searchFields.getGroupId()) )
        {
            q.add(indexer.constructQuery(MAVEN.GROUP_ID, new StringSearchExpression(searchFields.getGroupId())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getArtifactId()) )
        {
            q.add(indexer.constructQuery(MAVEN.ARTIFACT_ID, new StringSearchExpression(searchFields.getArtifactId())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getVersion()) )
        {
            q.add(indexer.constructQuery(MAVEN.VERSION, new StringSearchExpression(searchFields.getVersion())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getPackaging()) )
        {
            q.add(indexer.constructQuery(MAVEN.PACKAGING, new StringSearchExpression(searchFields.getPackaging())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getClassName()) )
        {
            q.add(indexer.constructQuery(MAVEN.CLASSNAMES, new StringSearchExpression(searchFields.getClassName())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleSymbolicName()) )
        {
            q.add(indexer.constructQuery(OSGI.SYMBOLIC_NAME,
                                         new StringSearchExpression(searchFields.getBundleSymbolicName())), Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleVersion()) )
        {
            q.add(indexer.constructQuery(OSGI.VERSION, new StringSearchExpression(searchFields.getBundleVersion())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleExportPackage()) )
        {
            q.add(indexer.constructQuery(OSGI.EXPORT_PACKAGE,
                                         new StringSearchExpression(searchFields.getBundleExportPackage())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleExportService()) )
        {
            q.add(indexer.constructQuery(OSGI.EXPORT_SERVICE,
                                         new StringSearchExpression(searchFields.getBundleExportService())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleImportPackage()) )
        {
            q.add(indexer.constructQuery(OSGI.IMPORT_PACKAGE,
                                         new StringSearchExpression(searchFields.getBundleImportPackage())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getBundleName()) )
        {
            q.add(indexer.constructQuery(OSGI.NAME, new StringSearchExpression(searchFields.getBundleName())),
                  Occur.MUST);
        }

        if ( StringUtils.isNotBlank(searchFields.getClassifier()) )
        {
            q.add(indexer.constructQuery(MAVEN.CLASSIFIER, new StringSearchExpression(searchFields.getClassifier())),
                  Occur.MUST);
        }

        if ( q.getClauses() == null || q.getClauses().length <= 0 )
        {
View Full Code Here

        return contexts;
    }

    private void constructQuery(String term, BooleanQuery q)
    {
        q.add(indexer.constructQuery(MAVEN.GROUP_ID, new StringSearchExpression(term)), Occur.SHOULD);
        q.add(indexer.constructQuery(MAVEN.ARTIFACT_ID, new StringSearchExpression(term)), Occur.SHOULD);
        q.add(indexer.constructQuery(MAVEN.VERSION, new StringSearchExpression(term)), Occur.SHOULD);
        q.add(indexer.constructQuery(MAVEN.PACKAGING, new StringSearchExpression(term)), Occur.SHOULD);
        q.add(indexer.constructQuery(MAVEN.CLASSNAMES, new StringSearchExpression(term)), Occur.SHOULD);

        //Query query =
        //    new WildcardQuery( new Term( MAVEN.CLASSNAMES.getFieldName(), "*" ) );
        //q.add( query, Occur.MUST_NOT );
        // olamy IMHO we could set this option as at least one must match
View Full Code Here

                                      getIndexingContext() );

        indexingExecutor.executeTask( task );

        BooleanQuery q = new BooleanQuery();
        q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
               Occur.SHOULD );
        q.add(
            indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
            Occur.SHOULD );

        if ( !indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ) )
        {
            IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
View Full Code Here

TOP

Related Classes of org.apache.maven.index.expr.StringSearchExpression

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.