@Deprecated public Set<ArtifactInfo> searchFlat( Comparator<ArtifactInfo> artifactInfoComparator, IndexingContext indexingContext, Query query ) throws IOException { return searchFlatPaged( new FlatSearchRequest( query, artifactInfoComparator, indexingContext ) ).getResults(); }
public FlatSearchResponse flatSearch( Map<String, String> terms, String repositoryId, Integer from, Integer count, Integer hitLimit ) throws NoSuchRepositoryException { // We do not support "old" style search anymore return new FlatSearchResponse( null, 0, Collections.<ArtifactInfo> emptySet() ); }
postprocessResults( result.getResults() ); return new FlatSearchResponse( req.getQuery(), -1, new HashSet<ArtifactInfo>() ); return new FlatSearchResponse( req.getQuery(), 0, new HashSet<ArtifactInfo>() );
postprocessResults( result.getResults() ); return new FlatSearchResponse( req.getQuery(), -1, new HashSet<ArtifactInfo>() ); return new FlatSearchResponse( req.getQuery(), 0, new HashSet<ArtifactInfo>() );
return new FlatSearchResponse( null, -1, new HashSet<ArtifactInfo>() ); postprocessResults( result.getResults() ); return new FlatSearchResponse( req.getQuery(), -1, new HashSet<ArtifactInfo>() ); return new FlatSearchResponse( req.getQuery(), 0, new HashSet<ArtifactInfo>() );
@Deprecated public Set<ArtifactInfo> searchFlat( Comparator<ArtifactInfo> artifactInfoComparator, Collection<IndexingContext> indexingContexts, Query query ) throws IOException { return searchFlatPaged( new FlatSearchRequest( query, artifactInfoComparator ), indexingContexts ).getResults(); }
/** * {@inheritDoc} */ public FlatSearchResponse flatSearch( final Map<String, String> terms, final String repositoryId, final Integer from, final Integer count, final Integer hitLimit ) throws NoSuchRepositoryException { if ( !canHandle( terms ) ) { return new FlatSearchResponse( null, 0, Collections.<ArtifactInfo> emptySet() ); } return m_lucene.searchArtifactFlat( terms.get( TERM_KEYWORD ), repositoryId, from, count, hitLimit ); }
private void listWar(TreeMap<VersionNumber, HudsonWar> r, String groupId, VersionNumber cap) throws IOException { BooleanQuery q = new BooleanQuery(); q.add(indexer.constructQuery(ArtifactInfo.GROUP_ID,groupId), Occur.MUST); q.add(indexer.constructQuery(ArtifactInfo.PACKAGING,"war"), Occur.MUST); FlatSearchRequest request = new FlatSearchRequest(q); FlatSearchResponse response = indexer.searchFlat(request); for (ArtifactInfo a : response.getResults()) { if (a.version.contains("SNAPSHOT")) continue; // ignore snapshots if (a.version.contains("JENKINS")) continue; // non-public releases for addressing specific bug fixes if (!a.artifactId.equals("jenkins-war") && !a.artifactId.equals("hudson-war")) continue; // somehow using this as a query results in 0 hits. if (a.classifier!=null) continue; // just pick up the main war if (IGNORE.containsKey(a.artifactId + "-" + a.version)) { System.out.println("=> Ignoring " + a.artifactId + ", version " + a.version + " because this version is blacklisted"); continue; } if (cap!=null && new VersionNumber(a.version).compareTo(cap)>0) continue; VersionNumber v = new VersionNumber(a.version); r.put(v, createHudsonWarArtifact(a)); } }
/** * {@inheritDoc} */ public FlatSearchResponse flatSearch( final Map<String, String> terms, final String repositoryId, final Integer from, final Integer count, final Integer hitLimit ) throws NoSuchRepositoryException { if ( !canHandle( terms ) ) { return new FlatSearchResponse( null, 0, Collections.<ArtifactInfo> emptySet() ); } return m_lucene.searchArtifactFlat( terms.get( TERM_GROUP ), terms.get( TERM_ARTIFACT ), terms.get( TERM_VERSION ), terms.get( TERM_PACKAGING ), terms.get( TERM_CLASSIFIER ), repositoryId, from, count, hitLimit ); }
ARTIFACTS: for (ArtifactInfo a : response.getResults()) { if (a.version.contains("SNAPSHOT")) continue; // ignore snapshots if (a.version.contains("JENKINS")) continue; // non-public releases for addressing specific bug fixes
/** * {@inheritDoc} */ public FlatSearchResponse flatSearch( final Map<String, String> terms, final String repositoryId, final Integer from, final Integer count, final Integer hitLimit ) throws NoSuchRepositoryException { if ( !canHandle( terms ) ) { return new FlatSearchResponse( null, 0, Collections.<ArtifactInfo> emptySet() ); } return m_lucene.searchArtifactClassFlat( terms.get( TERM_CLASSNAME ), repositoryId, from, count, hitLimit ); }
public ArchetypeCatalog getArchetypeCatalog( Properties properties ) throws ArchetypeDataSourceException { ArchetypeCatalog catalog = new ArchetypeCatalog(); try { Map<String, String> repositories = getRepositoryMap(); Query pq = indexer.constructQuery( ArtifactInfo.PACKAGING, "^maven-archetype$" ); FlatSearchRequest searchRequest = new FlatSearchRequest( pq ); // cstamas: old code was this // FlatSearchRequest searchRequest = new FlatSearchRequest( // // new TermQuery( new Term( ArtifactInfo.PACKAGING, "maven-archetype" ) ) ); FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest ); for ( ArtifactInfo info : searchResponse.getResults() ) { Archetype archetype = new Archetype(); archetype.setGroupId( info.groupId ); archetype.setArtifactId( info.artifactId ); archetype.setVersion( info.version ); archetype.setDescription( info.description ); archetype.setRepository( repositories.get( info.repository ) ); catalog.addArchetype( archetype ); } } catch ( Exception ex ) { getLogger().error( "Unable to retrieve archetypes", ex ); } return catalog; }
public FlatSearchResponse searchFlatPaged( FlatSearchRequest request ) throws IOException { TreeSet<ArtifactInfo> result = new TreeSet<ArtifactInfo>( request.getArtifactInfoComparator() ); int totalHits = 0; for ( IndexingContext context : request.getContexts() ) { totalHits += searchFlat( request, result, context, request.getQuery(), request.getStart(), request.getCount() ); } return new FlatSearchResponse( request.getQuery(), totalHits, result ); }
return new FlatSearchResponse( request.getQuery(), totalHits, result );