[maven-indexer] branch MINDEXER-104-lucene8 updated (3ced07f -> 9b46e18)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven-indexer] branch MINDEXER-104-lucene8 updated (3ced07f -> 9b46e18)

slachiewicz
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MINDEXER-104-lucene8
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git.


 discard 3ced07f  [MINDEXER-104] Changes needed to migrate to Lucene 8
     add 07bc974  (doc) checkstyle-plugin use latest Checkstyle 8.41.1
     add 3d5bcc6  (doc) fix checkstyle issue
     add 7fcc9c1  Upgrade Guice to 5.0.1 to resolve problems with Java 16
     new 65b48b2  [MINDEXER-104] Changes needed to migrate to Lucene 8
     new 9b46e18  Bump lucene.version to 8.8.1

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3ced07f)
            \
             N -- N -- N   refs/heads/MINDEXER-104-lucene8 (9b46e18)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../maven/index/artifact/M2GavCalculator.java      |  4 ++--
 .../examples/indexing/IndexerConfiguration.java    |  4 +---
 pom.xml                                            | 22 ++++++++--------------
 3 files changed, 11 insertions(+), 19 deletions(-)
Reply | Threaded
Open this post in threaded view
|

[maven-indexer] 01/02: [MINDEXER-104] Changes needed to migrate to Lucene 8

slachiewicz
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINDEXER-104-lucene8
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git

commit 65b48b2a3507d1a0bd564fda58799abbb3277e21
Author: Mat Booth <[hidden email]>
AuthorDate: Thu Jun 13 09:49:49 2019 +0100

    [MINDEXER-104] Changes needed to migrate to Lucene 8
   
    Including:
      * Some static functions moved: MultiFields -> MultiBits
      * totalHits -> totalHits.value (and this type also changed int -> long)
      * Addtional threshold param added to TopScoreDocCollector.create calls
        and set conservatively high to preserve existing behaviour
      * Actually attempt to get the lock instead of calling IndexWriter.isLocked
      * Use TokenFilters to transform tokens to lower case
      * No need to set write lock timeout to zero, this functionality moved to a
        wrapper in the case we actually need timeouts in the future
      * No need to disable coord on boolean queries, this functionality went away
      * Fixing up NexusIndexerTest test results accordingly
      * Some misc other warnings fixed (unused variables and imports)
   
    Signed-off-by: Mat Booth <[hidden email]>
---
 .../java/org/apache/maven/index/ArtifactInfo.java  |  3 --
 .../apache/maven/index/DefaultIndexerEngine.java   |  2 +-
 .../apache/maven/index/DefaultScannerListener.java |  6 ++--
 .../apache/maven/index/DefaultSearchEngine.java    |  6 ++--
 .../index/context/DefaultIndexingContext.java      | 34 ++++++++++++++--------
 .../org/apache/maven/index/context/IndexUtils.java |  2 --
 .../apache/maven/index/context/NexusAnalyzer.java  | 21 ++++---------
 .../maven/index/context/NexusIndexWriter.java      |  1 -
 .../maven/index/context/NexusLegacyAnalyzer.java   | 12 ++++----
 .../incremental/DefaultIncrementalHandler.java     |  4 +--
 .../maven/index/updater/DefaultIndexUpdater.java   | 15 +++++-----
 .../maven/index/updater/IndexDataWriter.java       |  4 +--
 .../maven/index/AbstractRepoNexusIndexerTest.java  |  4 +--
 .../maven/index/Nexus737NexusIndexerTest.java      |  4 +--
 .../org/apache/maven/index/NexusIndexerTest.java   |  9 +++---
 .../maven/index/context/NexusAnalyzerTest.java     |  4 +--
 .../resources/testQueryCreatorNGSearch/case01.txt  |  2 +-
 .../resources/testQueryCreatorNGSearch/case05.txt  |  2 +-
 .../maven/indexer/examples/BasicUsageExample.java  |  4 +--
 pom.xml                                            |  2 +-
 20 files changed, 67 insertions(+), 74 deletions(-)

diff --git a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
index 56c3891..490c02f 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
@@ -334,9 +334,6 @@ public class ArtifactInfo
 
     private final transient VersionScheme versionScheme;
 
-    private String uinfo = null;
-
-
     public ArtifactInfo()
     {
         versionScheme = new GenericVersionScheme();
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
index 87b7c2d..46965f0 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
@@ -160,7 +160,7 @@ public class DefaultIndexerEngine
                     indexSearcher.search(
                         new TermQuery( new Term( ArtifactInfo.UINFO, ac.getArtifactInfo().getUinfo() ) ), 2 );
 
-                if ( result.totalHits == 1 )
+                if ( result.totalHits.value == 1 )
                 {
                     return indexSearcher.doc( result.scoreDocs[0].doc );
                 }
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
index 01f6f4c..2d0c8ca 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
@@ -28,7 +28,7 @@ import java.util.Set;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.TermQuery;
@@ -212,7 +212,7 @@ public class DefaultScannerListener
         try
         {
             final IndexReader r = indexSearcher.getIndexReader();
-            Bits liveDocs = MultiFields.getLiveDocs( r );
+            Bits liveDocs = MultiBits.getLiveDocs( r );
 
             for ( int i = 0; i < r.maxDoc(); i++ )
             {
@@ -261,7 +261,7 @@ public class DefaultScannerListener
         {
             for ( String uinfo : uinfos )
             {
-                TopScoreDocCollector collector = TopScoreDocCollector.create( 1 );
+                TopScoreDocCollector collector = TopScoreDocCollector.create( 1, Integer.MAX_VALUE );
 
                 indexSearcher.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), collector );
 
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
index 3155e6f..b52b870 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
@@ -317,7 +317,7 @@ public class DefaultSearchEngine
         if ( AbstractSearchRequest.UNDEFINED != topHitCount )
         {
             // count is set, simply just execute it as-is
-            final TopScoreDocCollector hits = TopScoreDocCollector.create( topHitCount );
+            final TopScoreDocCollector hits = TopScoreDocCollector.create( topHitCount, Integer.MAX_VALUE );
 
             indexSearcher.search( query, hits );
 
@@ -329,7 +329,7 @@ public class DefaultSearchEngine
             topHitCount = 1000;
 
             // perform search
-            TopScoreDocCollector hits = TopScoreDocCollector.create( topHitCount );
+            TopScoreDocCollector hits = TopScoreDocCollector.create( topHitCount, Integer.MAX_VALUE );
             indexSearcher.search( query, hits );
 
             // check total hits against, does it fit?
@@ -348,7 +348,7 @@ public class DefaultSearchEngine
                 }
 
                 // redo all, but this time with correct numbers
-                hits = TopScoreDocCollector.create( topHitCount );
+                hits = TopScoreDocCollector.create( topHitCount, Integer.MAX_VALUE );
                 indexSearcher.search( query, hits );
             }
 
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java b/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
index 8e58206..7a6988a 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
@@ -43,7 +43,7 @@ import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.SearcherManager;
@@ -242,7 +242,11 @@ public class DefaultIndexingContext
             try
             {
                 // unlock the dir forcibly
-                if ( IndexWriter.isLocked( indexDirectory ) )
+                try
+                {
+                    indexDirectory.obtainLock( IndexWriter.WRITE_LOCK_NAME ).close();
+                }
+                catch ( LockObtainFailedException failed )
                 {
                     unlockForcibly( lockFactory, indexDirectory );
                 }
@@ -279,7 +283,11 @@ public class DefaultIndexingContext
             closeReaders();
 
             // unlock the dir forcibly
-            if ( IndexWriter.isLocked( indexDirectory ) )
+            try
+            {
+                indexDirectory.obtainLock( IndexWriter.WRITE_LOCK_NAME ).close();
+            }
+            catch ( LockObtainFailedException failed )
             {
                 unlockForcibly( lockFactory, indexDirectory );
             }
@@ -310,7 +318,7 @@ public class DefaultIndexingContext
         // check for descriptor if this is not a "virgin" index
         if ( getSize() > 0 )
         {
-            final TopScoreDocCollector collector = TopScoreDocCollector.create( 1 );
+            final TopScoreDocCollector collector = TopScoreDocCollector.create( 1, Integer.MAX_VALUE );
             final IndexSearcher indexSearcher = acquireIndexSearcher();
             try
             {
@@ -531,7 +539,7 @@ public class DefaultIndexingContext
 
         this.indexWriter = new NexusIndexWriter( getIndexDirectory(), getWriterConfig() );
         this.indexWriter.commit(); // LUCENE-2386
-        this.searcherManager = new SearcherManager( indexWriter, false, new NexusIndexSearcherFactory( this ) );
+        this.searcherManager = new SearcherManager( indexWriter, false, false, new NexusIndexSearcherFactory( this ) );
     }
 
     /**
@@ -672,8 +680,8 @@ public class DefaultIndexingContext
             {
                 TopScoreDocCollector collector;
                 int numDocs = directoryReader.maxDoc();
-
-                Bits liveDocs = MultiFields.getLiveDocs( directoryReader );
+                
+                Bits liveDocs = MultiBits.getLiveDocs( directoryReader );
                 for ( int i = 0; i < numDocs; i++ )
                 {
                     if ( liveDocs != null && !liveDocs.get( i ) )
@@ -690,7 +698,7 @@ public class DefaultIndexingContext
                     String uinfo = d.get( ArtifactInfo.UINFO );
                     if ( uinfo != null )
                     {
-                        collector = TopScoreDocCollector.create( 1 );
+                        collector = TopScoreDocCollector.create( 1, Integer.MAX_VALUE );
                         s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), collector );
                         if ( collector.getTotalHits() == 0 )
                         {
@@ -777,7 +785,7 @@ public class DefaultIndexingContext
             Set<String> allGroups = new LinkedHashSet<>();
 
             int numDocs = r.maxDoc();
-            Bits liveDocs = MultiFields.getLiveDocs( r );
+            Bits liveDocs = MultiBits.getLiveDocs( r );
 
             for ( int i = 0; i < numDocs; i++ )
             {
@@ -838,14 +846,16 @@ public class DefaultIndexingContext
     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
+            Set<String> groups = new LinkedHashSet<String>( (int) Math.max( 10L, topDocs.totalHits.value ) );
+            if ( topDocs.totalHits.value > 0 )
             {
                 Document doc = indexSearcher.doc( topDocs.scoreDocs[0].doc );
                 String groupList = doc.get( listField );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java b/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
index f7ef771..65b891d 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
@@ -44,8 +44,6 @@ public class IndexUtils
 {
     public static final String TIMESTAMP_FILE = "timestamp";
 
-    private static final int BUFFER_SIZE = 16384;
-
     // Directory
 
     public static void copyDirectory( Directory source, Directory target )
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
index b5f49b1..95624ff 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
@@ -21,6 +21,8 @@ package org.apache.maven.index.context;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.AnalyzerWrapper;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.LowerCaseFilter;
 import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.maven.index.creator.JarFileContentsIndexCreator;
 
@@ -40,7 +42,8 @@ public final class NexusAnalyzer
         @Override
         protected TokenStreamComponents createComponents( String fieldName )
         {
-            return new TokenStreamComponents( new DeprecatedClassnamesTokenizer() );
+            final Tokenizer tokenizer = new DeprecatedClassnamesTokenizer();
+            return new TokenStreamComponents( tokenizer, new LowerCaseFilter( tokenizer ) );
         }
     };
 
@@ -49,7 +52,8 @@ public final class NexusAnalyzer
         @Override
         protected TokenStreamComponents createComponents( String filedName )
         {
-            return new TokenStreamComponents( new LetterOrDigitTokenizer() );
+            final Tokenizer tokenizer = new LetterOrDigitTokenizer();
+            return new TokenStreamComponents( tokenizer, new LowerCaseFilter( tokenizer ) );
         }
     };
 
@@ -103,12 +107,6 @@ public final class NexusAnalyzer
         {
             return i != '\n';
         }
-        
-        @Override
-        protected int normalize( int c )
-        {
-            return Character.toLowerCase( c );
-        }
     }
 
     public static class LetterOrDigitTokenizer
@@ -124,12 +122,5 @@ public final class NexusAnalyzer
         {
             return Character.isLetterOrDigit( c );
         }
-
-        @Override
-        protected int normalize( int c )
-        {
-            return Character.toLowerCase( c );
-        }
     }
-
 }
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
index eb2246b..a93ed10 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
@@ -63,7 +63,6 @@ public class NexusIndexWriter
         // default open mode is CreateOrAppend which suits us
         config.setRAMBufferSizeMB( 2.0 ); // old default
         config.setMergeScheduler( new SerialMergeScheduler() ); // merging serially
-        config.setWriteLockTimeout( IndexWriterConfig.WRITE_LOCK_TIMEOUT );
         return config;
     }
 }
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
index 4cb15ce..21d8a41 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
@@ -21,6 +21,8 @@ package org.apache.maven.index.context;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.AnalyzerWrapper;
+import org.apache.lucene.analysis.LowerCaseFilter;
+import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.maven.index.ArtifactInfo;
@@ -42,20 +44,16 @@ public final class NexusLegacyAnalyzer
         @Override
         protected TokenStreamComponents createComponents( final String fieldName )
         {
-            return new TokenStreamComponents( new CharTokenizer()
+            final Tokenizer tokenizer = new CharTokenizer()
             {
                 @Override
                 protected boolean isTokenChar( int c )
                 {
                     return Character.isLetterOrDigit( c );
                 }
+            };
 
-                @Override
-                protected int normalize( int c )
-                {
-                    return Character.toLowerCase( c );
-                }
-            } );
+            return new TokenStreamComponents( tokenizer, new LowerCaseFilter( tokenizer ) );
         }
     };
 
diff --git a/indexer-core/src/main/java/org/apache/maven/index/incremental/DefaultIncrementalHandler.java b/indexer-core/src/main/java/org/apache/maven/index/incremental/DefaultIncrementalHandler.java
index a99d140..e3689cb 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/incremental/DefaultIncrementalHandler.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/incremental/DefaultIncrementalHandler.java
@@ -39,7 +39,7 @@ import javax.inject.Singleton;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.util.Bits;
 import org.apache.maven.index.ArtifactInfo;
 import org.apache.maven.index.context.IndexingContext;
@@ -157,7 +157,7 @@ public class DefaultIncrementalHandler
     {
         final List<Integer> chunk = new ArrayList<>();
         final IndexReader r = request.getIndexReader();
-        Bits liveDocs = MultiFields.getLiveDocs( r );
+        Bits liveDocs = MultiBits.getLiveDocs( r );
         for ( int i = 0; i < r.maxDoc(); i++ )
         {
             if ( liveDocs == null || liveDocs.get( i ) )
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
index 0bdf03e..cbc3f60 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
@@ -48,7 +48,8 @@ import org.apache.lucene.document.Document;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.maven.index.context.DocumentFilter;
@@ -260,9 +261,9 @@ public class DefaultIndexUpdater
         try
         {
             r = DirectoryReader.open( directory );
-            w = new NexusIndexWriter( directory, new NexusAnalyzer(), false );
-            
-            Bits liveDocs = MultiFields.getLiveDocs( r );
+            w = new NexusIndexWriter( directory, new IndexWriterConfig( new NexusAnalyzer() ) );
+
+            Bits liveDocs = MultiBits.getLiveDocs( r );
 
             int numDocs = r.maxDoc();
 
@@ -277,7 +278,7 @@ public class DefaultIndexUpdater
 
                 if ( !filter.accept( d ) )
                 {
-                    boolean success = w.tryDeleteDocument( r, i );
+                    boolean success = w.tryDeleteDocument( r, i ) != -1;
                     // FIXME handle deletion failure
                 }
             }
@@ -293,7 +294,7 @@ public class DefaultIndexUpdater
         try
         {
             // analyzer is unimportant, since we are not adding/searching to/on index, only reading/deleting
-            w = new NexusIndexWriter( directory, new NexusAnalyzer(), false );
+            w = new NexusIndexWriter( directory, new IndexWriterConfig( new NexusAnalyzer() ) );
 
             w.commit();
         }
@@ -381,7 +382,7 @@ public class DefaultIndexUpdater
                                                        final IndexingContext context )
         throws IOException
     {
-        NexusIndexWriter w = new NexusIndexWriter( d, new NexusAnalyzer(), true );
+        NexusIndexWriter w = new NexusIndexWriter( d, new IndexWriterConfig( new NexusAnalyzer() ) );
         try
         {
             IndexDataReader dr = new IndexDataReader( is );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
index 00090fb..bd759fe 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
@@ -35,7 +35,7 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexOptions;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.util.Bits;
 import org.apache.maven.index.ArtifactInfo;
 import org.apache.maven.index.IndexerField;
@@ -143,7 +143,7 @@ public class IndexDataWriter
         throws IOException
     {
         int n = 0;
-        Bits liveDocs = MultiFields.getLiveDocs( r );
+        Bits liveDocs = MultiBits.getLiveDocs( r );
 
         if ( docIndexes == null )
         {
diff --git a/indexer-core/src/test/java/org/apache/maven/index/AbstractRepoNexusIndexerTest.java b/indexer-core/src/test/java/org/apache/maven/index/AbstractRepoNexusIndexerTest.java
index 554ff7a..49919c5 100644
--- a/indexer-core/src/test/java/org/apache/maven/index/AbstractRepoNexusIndexerTest.java
+++ b/indexer-core/src/test/java/org/apache/maven/index/AbstractRepoNexusIndexerTest.java
@@ -29,7 +29,7 @@ import java.util.Set;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.Bits;
 import org.apache.maven.index.search.grouping.GAGrouping;
@@ -514,7 +514,7 @@ public abstract class AbstractRepoNexusIndexerTest
     {
         IndexReader reader = context.acquireIndexSearcher().getIndexReader();
 
-        Bits liveDocs = MultiFields.getLiveDocs(reader);
+        Bits liveDocs = MultiBits.getLiveDocs(reader);
         for ( int i = 0; i < reader.maxDoc(); i++ )
         {
             if (liveDocs == null || liveDocs.get(i) )
diff --git a/indexer-core/src/test/java/org/apache/maven/index/Nexus737NexusIndexerTest.java b/indexer-core/src/test/java/org/apache/maven/index/Nexus737NexusIndexerTest.java
index adb8393..8d073ec 100644
--- a/indexer-core/src/test/java/org/apache/maven/index/Nexus737NexusIndexerTest.java
+++ b/indexer-core/src/test/java/org/apache/maven/index/Nexus737NexusIndexerTest.java
@@ -23,7 +23,7 @@ import java.io.File;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.util.Bits;
 
 /** http://issues.sonatype.org/browse/NEXUS-737 */
@@ -45,7 +45,7 @@ public class Nexus737NexusIndexerTest
         throws Exception
     {
         IndexReader reader = context.acquireIndexSearcher().getIndexReader();
-        Bits liveDocs = MultiFields.getLiveDocs(reader);
+        Bits liveDocs = MultiBits.getLiveDocs(reader);
 
         int foundCount = 0;
 
diff --git a/indexer-core/src/test/java/org/apache/maven/index/NexusIndexerTest.java b/indexer-core/src/test/java/org/apache/maven/index/NexusIndexerTest.java
index ec99400..a221747 100644
--- a/indexer-core/src/test/java/org/apache/maven/index/NexusIndexerTest.java
+++ b/indexer-core/src/test/java/org/apache/maven/index/NexusIndexerTest.java
@@ -80,7 +80,7 @@ public class NexusIndexerTest
         
         // scored search against field having tokenized IndexerField only (should be impossible).
         q = indexer.constructQuery( MAVEN.NAME, "Some artifact name from Pom", SearchType.SCORED );
-        assertThat(q.toString(), is("(+n:some +n:artifact +n:name +n:from +n:pom*) n:\"some artifact name from pom\""));
+        assertThat(q.toString(), is("(+n:some +n:artifact +n:name +n:from +n:Pom*) n:\"some artifact name from pom\""));
     }
     
     public void testQueryCreatorNG()
@@ -116,19 +116,19 @@ public class NexusIndexerTest
         // scored search against field having untokenized indexerField only
         q = indexer.constructQuery( MAVEN.PACKAGING, "maven-archetype", SearchType.SCORED );
 
-        assertEquals( "p:maven-archetype p:maven-archetype*^0.8", q.toString() );
+        assertEquals( "p:maven-archetype (p:maven-archetype*)^0.8", q.toString() );
 
         // scored search against field having untokenized indexerField only
         q = indexer.constructQuery( MAVEN.ARTIFACT_ID, "commons-logging", SearchType.SCORED );
 
         assertEquals(
-            "(a:commons-logging a:commons-logging*^0.8) ((+artifactId:commons +artifactId:logging*) artifactId:\"commons logging\")",
+            "(a:commons-logging (a:commons-logging*)^0.8) ((+artifactId:commons +artifactId:logging*) artifactId:\"commons logging\")",
             q.toString() );
 
         // scored search against field having tokenized IndexerField only (should be impossible).
         q = indexer.constructQuery( MAVEN.NAME, "Some artifact name from Pom", SearchType.SCORED );
 
-        assertEquals( "(+n:some +n:artifact +n:name +n:from +n:pom*) n:\"some artifact name from pom\"", q.toString() );
+        assertEquals( "(+n:some +n:artifact +n:name +n:from +n:Pom*) n:\"some artifact name from pom\"", q.toString() );
 
         // keyword search against field having tokenized IndexerField only (should be impossible).
         q = indexer.constructQuery( MAVEN.NAME, "some artifact name from Pom", SearchType.EXACT );
@@ -439,7 +439,6 @@ public class NexusIndexerTest
 
         {
             BooleanQuery bq = new BooleanQuery.Builder()
-                .setDisableCoord( true )
                 .add( new WildcardQuery( new Term( ArtifactInfo.GROUP_ID, "testng*" ) ), Occur.SHOULD )
                 .add( new WildcardQuery( new Term( ArtifactInfo.ARTIFACT_ID, "testng*" ) ), Occur.SHOULD )
                 .setMinimumNumberShouldMatch( 1 )
diff --git a/indexer-core/src/test/java/org/apache/maven/index/context/NexusAnalyzerTest.java b/indexer-core/src/test/java/org/apache/maven/index/context/NexusAnalyzerTest.java
index 2793b64..a4929ab 100644
--- a/indexer-core/src/test/java/org/apache/maven/index/context/NexusAnalyzerTest.java
+++ b/indexer-core/src/test/java/org/apache/maven/index/context/NexusAnalyzerTest.java
@@ -26,7 +26,7 @@ import java.util.Arrays;
 
 import junit.framework.TestCase;
 
-import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.maven.index.IndexerField;
 import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator;
@@ -55,7 +55,7 @@ public class NexusAnalyzerTest
     protected void runAndCompare( IndexerField indexerField, String text, String[] expected )
         throws IOException
     {
-        Tokenizer ts = (Tokenizer) nexusAnalyzer.tokenStream(indexerField.getKey(), new StringReader( text ) );
+        TokenStream ts = nexusAnalyzer.tokenStream(indexerField.getKey(), new StringReader( text ) );
         ts.reset();
 
         ArrayList<String> tokenList = new ArrayList<>();
diff --git a/indexer-core/src/test/resources/testQueryCreatorNGSearch/case01.txt b/indexer-core/src/test/resources/testQueryCreatorNGSearch/case01.txt
index 17691d9..f9f959c 100644
--- a/indexer-core/src/test/resources/testQueryCreatorNGSearch/case01.txt
+++ b/indexer-core/src/test/resources/testQueryCreatorNGSearch/case01.txt
@@ -1,4 +1,4 @@
-### Searched for field urn:maven#groupId (with 2 registered index fields) using query "commons-logg" (QC create LQL "(g:commons-logg g:commons-logg*^0.8) ((+groupId:commons +groupId:logg*) groupId:"commons logg")")
+### Searched for field urn:maven#groupId (with 2 registered index fields) using query "commons-logg" (QC create LQL "(g:commons-logg (g:commons-logg*)^0.8) ((+groupId:commons +groupId:logg*) groupId:"commons logg")")
 test :: commons-logging:commons-logging:1.1:null:jar
 test :: commons-logging:commons-logging:1.1:sources:jar
 test :: commons-logging:commons-logging:1.0.4:null:jar
diff --git a/indexer-core/src/test/resources/testQueryCreatorNGSearch/case05.txt b/indexer-core/src/test/resources/testQueryCreatorNGSearch/case05.txt
index bd52ac6..485b3f5 100644
--- a/indexer-core/src/test/resources/testQueryCreatorNGSearch/case05.txt
+++ b/indexer-core/src/test/resources/testQueryCreatorNGSearch/case05.txt
@@ -1,4 +1,4 @@
-### Searched for field urn:maven#version (with 2 registered index fields) using query "1.0" (QC create LQL "(v:1.0 v:1.0*^0.8) ((+version:1 +version:0*) version:"1 0")")
+### Searched for field urn:maven#version (with 2 registered index fields) using query "1.0" (QC create LQL "(v:1.0 (v:1.0*)^0.8) ((+version:1 +version:0*) version:"1 0")")
 test :: proptest:proptest-archetype:1.0:null:maven-archetype
 test :: org.apache.maven.plugins:maven-core-it-plugin:1.0:null:maven-plugin
 test :: org.apache.maven.plugins:maven-core-it-plugin:1.0:sources:jar
diff --git a/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java b/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
index a918dfd..b0cd9eb 100644
--- a/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
+++ b/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
@@ -21,7 +21,7 @@ package org.apache.maven.indexer.examples;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.MultiBits;
 import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
@@ -202,7 +202,7 @@ public class BasicUsageExample
             try
             {
                 final IndexReader ir = searcher.getIndexReader();
-                Bits liveDocs = MultiFields.getLiveDocs( ir );
+                Bits liveDocs = MultiBits.getLiveDocs( ir );
                 for ( int i = 0; i < ir.maxDoc(); i++ )
                 {
                     if ( liveDocs == null || liveDocs.get( i ) )
diff --git a/pom.xml b/pom.xml
index cb96deb..ecb162d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,7 +91,7 @@ under the License.
 
     <eclipse-sisu.version>0.3.4</eclipse-sisu.version>
     <guice.version>5.0.1</guice.version>
-    <lucene.version>5.5.5</lucene.version>
+    <lucene.version>8.5.0</lucene.version>
     <maven.version>3.8.1</maven.version>
     <resolver.version>1.6.2</resolver.version>
     <archetype.version>3.2.0</archetype.version>
Reply | Threaded
Open this post in threaded view
|

[maven-indexer] 02/02: Bump lucene.version to 8.8.1

slachiewicz
In reply to this post by slachiewicz
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINDEXER-104-lucene8
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git

commit 9b46e18e4653528026083dece09bdf16d733b3ef
Author: Sylwester Lachiewicz <[hidden email]>
AuthorDate: Mon Apr 5 16:46:27 2021 +0200

    Bump lucene.version to 8.8.1
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index ecb162d..acb8a2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,7 +91,7 @@ under the License.
 
     <eclipse-sisu.version>0.3.4</eclipse-sisu.version>
     <guice.version>5.0.1</guice.version>
-    <lucene.version>8.5.0</lucene.version>
+    <lucene.version>8.8.1</lucene.version>
     <maven.version>3.8.1</maven.version>
     <resolver.version>1.6.2</resolver.version>
     <archetype.version>3.2.0</archetype.version>