You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/02/02 17:46:11 UTC

[GitHub] [maven-indexer] carlspring commented on a change in pull request #169: [MINDEXER-104] Migrate to Lucene 8.x

carlspring commented on a change in pull request #169:
URL: https://github.com/apache/maven-indexer/pull/169#discussion_r797865059



##########
File path: indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
##########
@@ -834,14 +842,16 @@ public synchronized void setRootGroups( Collection<String> groups )
     protected Set<String> getGroups( String field, String filedValue, String listField )
         throws IOException, CorruptIndexException
     {
-        final TopScoreDocCollector collector = TopScoreDocCollector.create( 1 );
+        final TopScoreDocCollector collector = TopScoreDocCollector.create( 1, Integer.MAX_VALUE );
         final IndexSearcher indexSearcher = acquireIndexSearcher();
         try
         {
             indexSearcher.search( new TermQuery( new Term( field, filedValue ) ), collector );
             TopDocs topDocs = collector.topDocs();
-            Set<String> groups = new LinkedHashSet<>( Math.max( 10, topDocs.totalHits ) );
-            if ( topDocs.totalHits > 0 )
+            // In Lucene 7 topDocs.totalHits is now a long, but we can safely cast this to an int because
+            // indexes are still bound to at most 2 billion (Integer.MAX_VALUE) documents

Review comment:
       Thanks for this clarification!
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org