Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] maven indexer - reading data from indexing context

Hello

I have indexed local maven repository...now I need to retrieve all informations regarding every artefacts...

do I understand it correct that I should use search query...and I will get all gathered information from the indexingContext??


those were my indexers:

     List<IndexCreator> indexers = new ArrayList<>();
        indexers.add(plexusContainer.lookup(IndexCreator.class, "min"));
        indexers.add( plexusContainer.lookup( IndexCreator.class, "maven-archetype" ) );
        indexers.add( plexusContainer.lookup( IndexCreator.class, "osgi-metadatas" ) );

so now I need to create search querry?

public Map<String, Collection<ArtifactInfo>> getResultsMap( String repositoryId,
                                                                String query )
            throws IOException, ParseException
    {
        Map<String, Collection<ArtifactInfo>> resultsMap = new LinkedHashMap<>();
        final Set<ArtifactInfo> artifactInfoResults = repositoryIndexManager.getRepositoryIndex( repositoryId )
                                                                            .search( query );

        if ( !artifactInfoResults.isEmpty() )
        {
            resultsMap.put( repositoryId, artifactInfoResults );
        }

        return resultsMap;
    }

Thanks

Back to the top