public void searchGroupedAndDump( Indexer nexusIndexer, String descr, Query q, Grouping g ) throws IOException { System.out.println( "Searching for " + descr ); GroupedSearchResponse response = nexusIndexer.searchGrouped( new GroupedSearchRequest( q, g, centralContext ) ); for ( Map.Entry<String, ArtifactInfoGroup> entry : response.getResults().entrySet() ) { ArtifactInfo ai = entry.getValue().getArtifactInfos().iterator().next(); System.out.println( "* Entry " + ai ); System.out.println( " Latest version: " + ai.getVersion() ); System.out.println( StringUtils.isBlank( ai.getDescription() ) ? "No description in plugin's POM." : StringUtils.abbreviate( ai.getDescription(), MAX_WIDTH ) ); System.out.println(); } System.out.println( "------" ); System.out.println( "Total record hits: " + response.getTotalHitsCount() ); System.out.println(); } }
if ( ai.getDescription() != null ) doc.add( FLD_DESCRIPTION.toField( ai.getDescription() ) );
if ( ai.getDescription() != null ) doc.add( FLD_DESCRIPTION.toField( ai.getDescription() ) );
if ( ai.getDescription() != null ) doc.add( FLD_DESCRIPTION.toField( ai.getDescription() ) );
public ArchetypeCatalog getArchetypeCatalog( final Properties properties ) { final ArchetypeCatalog catalog = new ArchetypeCatalog(); try { final Map<String, String> repositories = getRepositoryMap(); final Query pq = indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) ); final FlatSearchRequest searchRequest = new FlatSearchRequest( pq ); searchRequest.setContexts( getIndexingContexts() ); final FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest ); for ( ArtifactInfo info : searchResponse.getResults() ) { Archetype archetype = new Archetype(); archetype.setGroupId( info.getGroupId() ); archetype.setArtifactId( info.getArtifactId() ); archetype.setVersion( info.getVersion() ); archetype.setDescription( info.getDescription() ); archetype.setRepository( repositories.get( info.getRepository() ) ); catalog.addArchetype( archetype ); } } catch ( Exception ex ) { getLogger().error( "Unable to retrieve archetypes", ex ); } return catalog; }
public ArchetypeCatalog getArchetypeCatalog( final Properties properties ) { final ArchetypeCatalog catalog = new ArchetypeCatalog(); try { final Map<String, String> repositories = getRepositoryMap(); final Query pq = indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) ); final FlatSearchRequest searchRequest = new FlatSearchRequest( pq ); searchRequest.setContexts( getIndexingContexts() ); final FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest ); for ( ArtifactInfo info : searchResponse.getResults() ) { Archetype archetype = new Archetype(); archetype.setGroupId( info.getGroupId() ); archetype.setArtifactId( info.getArtifactId() ); archetype.setVersion( info.getVersion() ); archetype.setDescription( info.getDescription() ); archetype.setRepository( repositories.get( info.getRepository() ) ); catalog.addArchetype( archetype ); } } catch ( Exception ex ) { getLogger().error( "Unable to retrieve archetypes", ex ); } return catalog; }
public ArchetypeCatalog getArchetypeCatalog( final Properties properties ) throws ArchetypeDataSourceException { final ArchetypeCatalog catalog = new ArchetypeCatalog(); try { final Map<String, String> repositories = getRepositoryMap(); final Query pq = indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) ); final FlatSearchRequest searchRequest = new FlatSearchRequest( pq ); searchRequest.setContexts( getIndexingContexts() ); final FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest ); for ( ArtifactInfo info : searchResponse.getResults() ) { Archetype archetype = new Archetype(); archetype.setGroupId( info.getGroupId() ); archetype.setArtifactId( info.getArtifactId() ); archetype.setVersion( info.getVersion() ); archetype.setDescription( info.getDescription() ); archetype.setRepository( repositories.get( info.getRepository() ) ); catalog.addArchetype( archetype ); } } catch ( Exception ex ) { getLogger().error( "Unable to retrieve archetypes", ex ); } return catalog; }