public ArtifactInfo identify( Query query, Collection<IndexingContext> contexts ) throws IOException { IteratorSearchResponse result = searcher.searchIteratorPaged( new IteratorSearchRequest( query ), contexts ); // TODO: this implementation is flakey: case a) 0 hits is okay, b) 1 hit is okay, c1) >1 hits and all same GAVs // -- okay but which source repo will be used? c2) >1 hits, and different GAVs --- huh? if ( result.getTotalHits() > 0 ) { return result.getResults().next(); } else { return null; } }
boolean tooManyResults = searchResult.isHitLimitExceeded(); result.setTotalCount( searchResult.getTotalHits() ); result.setData( new ArrayList<NexusArtifact>( ai2NaColl( request, searchResult.getResults() ) ) ); if ( collapseResults && result.getData().size() < searchResult.getTotalHits() && result.getData().size() < COLLAPSE_OVERRIDE_TRESHOLD && searchResult.getTotalHits() < HIT_LIMIT )
throws NoSuchRepositoryException response.setTooManyResults( iterator.isHitLimitExceeded() ); response.setTotalCount( iterator.getTotalHits() ); "Query terms \"" + terms + "\" (LQL \"" + iterator.getQuery().toString() + "\") matched total of " + iterator.getTotalHits() + " records, " + iterator.getTotalProcessedArtifactInfoCount() + " records were processed out of those, resulting in " + hits.size() + " unique GA records. Lucene scored documents first=" + firstDocumentScore + ", last="
if ( searchResponse.isHitLimitExceeded() ) else if ( collapseResults && searchResponse.getTotalHits() < COLLAPSE_OVERRIDE_TRESHOLD )
public IteratorResultSet iterator() { return getResults(); }
if ( result.getTotalHits() > 0 ) if ( result.getTotalHits() > 0 ) if ( result.getTotalHits() > 0 )
new SortField( null, SortField.DOC, false ) } ) ); return new IteratorSearchResponse( request.getQuery(), hits.length(), new DefaultIteratorResultSet( request, indexSearcher, contexts, hits ) );
if ( searchResponse.isHitLimitExceeded() ) else if ( collapseResults && searchResponse.getTotalHits() < COLLAPSE_OVERRIDE_TRESHOLD )
/** * A helper method delegating the call to the IteratorResultSet. * * @return */ public int getTotalProcessedArtifactInfoCount() { return getResults().getTotalProcessedArtifactInfoCount(); }
if ( collapseResults && result.getData().size() < searchResult.getTotalHits() && result.getData().size() < COLLAPSE_OVERRIDE_TRESHOLD && searchResult.getTotalHits() < GA_HIT_LIMIT )