]> source.dussan.org Git - gitblit.git/commitdiff
Bump to Lucene 5.5.2
authorLuca Milanesio <luca.milanesio@gmail.com>
Thu, 22 Dec 2016 00:42:56 +0000 (00:42 +0000)
committerFlorian Zschocke <florian.zschocke@devolo.de>
Sun, 5 Mar 2017 19:20:57 +0000 (20:20 +0100)
.classpath
build.moxie
gitblit.iml
src/main/java/com/gitblit/service/LuceneService.java
src/main/java/com/gitblit/tickets/TicketIndexer.java

index 3dac2010b4f8b5d961ac8752ab62b0231e650588..42756d8be9a78ca99d35535a74967a4969b3d117 100644 (file)
        <classpathentry kind="lib" path="ext/wicket-1.4.22.jar" sourcepath="ext/src/wicket-1.4.22.jar" />
        <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.22.jar" sourcepath="ext/src/wicket-auth-roles-1.4.22.jar" />
        <classpathentry kind="lib" path="ext/wicket-extensions-1.4.22.jar" sourcepath="ext/src/wicket-extensions-1.4.22.jar" />
-       <classpathentry kind="lib" path="ext/lucene-core-4.10.4.jar" sourcepath="ext/src/lucene-core-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-analyzers-common-4.10.4.jar" sourcepath="ext/src/lucene-analyzers-common-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-highlighter-4.10.4.jar" sourcepath="ext/src/lucene-highlighter-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-memory-4.10.4.jar" sourcepath="ext/src/lucene-memory-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-queries-4.10.4.jar" sourcepath="ext/src/lucene-queries-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-queryparser-4.10.4.jar" sourcepath="ext/src/lucene-queryparser-4.10.4.jar" />
-       <classpathentry kind="lib" path="ext/lucene-sandbox-4.10.4.jar" sourcepath="ext/src/lucene-sandbox-4.10.4.jar" />
+       <classpathentry kind="lib" path="ext/lucene-core-5.5.2.jar" sourcepath="ext/src/lucene-core-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-analyzers-common-5.5.2.jar" sourcepath="ext/src/lucene-analyzers-common-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-highlighter-5.5.2.jar" sourcepath="ext/src/lucene-highlighter-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-queries-5.5.2.jar" sourcepath="ext/src/lucene-queries-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-memory-5.5.2.jar" sourcepath="ext/src/lucene-memory-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-queryparser-5.5.2.jar" sourcepath="ext/src/lucene-queryparser-5.5.2.jar" />
+       <classpathentry kind="lib" path="ext/lucene-sandbox-5.5.2.jar" sourcepath="ext/src/lucene-sandbox-5.5.2.jar" />
        <classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
        <classpathentry kind="lib" path="ext/pegdown-1.5.0.jar" sourcepath="ext/src/pegdown-1.5.0.jar" />
        <classpathentry kind="lib" path="ext/parboiled-java-1.1.7.jar" sourcepath="ext/src/parboiled-java-1.1.7.jar" />
index eb05e2c81411c8b09a30f798190be13d12c7662e..9e5da7095509bdbf23998f2cee7783701663d8c1 100644 (file)
@@ -106,7 +106,7 @@ properties: {
   jetty.version  : 9.2.13.v20150730
   slf4j.version  : 1.7.12
   wicket.version : 1.4.22
-  lucene.version : 4.10.4
+  lucene.version : 5.5.2
   jgit.version   : 4.1.1.201511131810-r
   groovy.version : 2.4.4
   bouncycastle.version : 1.52
index 038c4f4d13cf3f99d76f38670a33fcdd2955c778..aefea941fca3e0cdea9f129f8adae9fe82c40a06 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-core-4.10.4.jar">
+      <library name="lucene-core-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-core-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-core-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-analyzers-common-4.10.4.jar">
+      <library name="lucene-analyzers-common-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-highlighter-4.10.4.jar">
+      <library name="lucene-highlighter-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-memory-4.10.4.jar">
+      <library name="lucene-join-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-memory-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-join-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-join-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-queries-4.10.4.jar">
+      <library name="lucene-grouping-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-queries-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-grouping-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-grouping-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-queryparser-4.10.4.jar">
+      <library name="lucene-queries-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-queries-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-sandbox-4.10.4.jar">
+      <library name="lucene-memory-5.5.2.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-memory-5.5.2.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-4.10.4.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-5.5.2.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
index 097a39b2f3e11750a180154f6cfe2385c19a3889..59b1ff248ebd4ba82c1d3720e10b44a1bcb8b4aa 100644 (file)
@@ -267,7 +267,7 @@ public class LuceneService implements Runnable {
                // close all writers\r
                for (String writer : writers.keySet()) {\r
                        try {\r
-                               writers.get(writer).close(true);\r
+                               writers.get(writer).close();\r
                        } catch (Throwable t) {\r
                                logger.error("Failed to close Lucene writer for " + writer, t);\r
                        }\r
@@ -722,8 +722,8 @@ public class LuceneService implements Runnable {
                String q = MessageFormat.format(pattern, SearchObjectType.blob.name(), branch, path);\r
 \r
                BooleanQuery query = new BooleanQuery();\r
-               StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
-               QueryParser qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);\r
+               StandardAnalyzer analyzer = new StandardAnalyzer();\r
+               QueryParser qp = new QueryParser(FIELD_SUMMARY, analyzer);\r
                query.add(qp.parse(q), Occur.MUST);\r
 \r
                IndexWriter writer = getIndexWriter(repositoryName);\r
@@ -968,14 +968,14 @@ public class LuceneService implements Runnable {
                IndexWriter indexWriter = writers.get(repository);\r
                File repositoryFolder = FileKey.resolve(new File(repositoriesFolder, repository), FS.DETECTED);\r
                File indexFolder = new File(repositoryFolder, LUCENE_DIR);\r
-               Directory directory = FSDirectory.open(indexFolder);\r
+               Directory directory = FSDirectory.open(indexFolder.toPath());\r
 \r
                if (indexWriter == null) {\r
                        if (!indexFolder.exists()) {\r
                                indexFolder.mkdirs();\r
                        }\r
-                       StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
-                       IndexWriterConfig config = new IndexWriterConfig(LUCENE_VERSION, analyzer);\r
+                       StandardAnalyzer analyzer = new StandardAnalyzer();\r
+                       IndexWriterConfig config = new IndexWriterConfig(analyzer);\r
                        config.setOpenMode(OpenMode.CREATE_OR_APPEND);\r
                        indexWriter = new IndexWriter(directory, config);\r
                        writers.put(repository, indexWriter);\r
@@ -1028,16 +1028,16 @@ public class LuceneService implements Runnable {
                        return null;\r
                }\r
                Set<SearchResult> results = new LinkedHashSet<SearchResult>();\r
-               StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
+               StandardAnalyzer analyzer = new StandardAnalyzer();\r
                try {\r
                        // default search checks summary and content\r
                        BooleanQuery query = new BooleanQuery();\r
                        QueryParser qp;\r
-                       qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);\r
+                       qp = new QueryParser(FIELD_SUMMARY, analyzer);\r
                        qp.setAllowLeadingWildcard(true);\r
                        query.add(qp.parse(text), Occur.SHOULD);\r
 \r
-                       qp = new QueryParser(LUCENE_VERSION, FIELD_CONTENT, analyzer);\r
+                       qp = new QueryParser(FIELD_CONTENT, analyzer);\r
                        qp.setAllowLeadingWildcard(true);\r
                        query.add(qp.parse(text), Occur.SHOULD);\r
 \r
@@ -1060,7 +1060,7 @@ public class LuceneService implements Runnable {
                        Query rewrittenQuery = searcher.rewrite(query);\r
                        logger.debug(rewrittenQuery.toString());\r
 \r
-                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000, true);\r
+                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000);\r
                        searcher.search(rewrittenQuery, collector);\r
                        int offset = Math.max(0, (page - 1) * pageSize);\r
                        ScoreDoc[] hits = collector.topDocs(offset, pageSize).scoreDocs;\r
@@ -1225,7 +1225,7 @@ public class LuceneService implements Runnable {
         */\r
        private class MultiSourceReader extends MultiReader {\r
 \r
-               MultiSourceReader(IndexReader [] readers) {\r
+               MultiSourceReader(IndexReader [] readers) throws IOException {\r
                        super(readers, false);\r
                }\r
 \r
index e2d53af7b6d2fe082d30d1031006e35477954a33..02af25ef12eaf79b134806b5ac00dc00388ab869 100644 (file)
@@ -167,7 +167,7 @@ public class TicketIndexer {
 
        private final Logger log = LoggerFactory.getLogger(getClass());
 
-       private final Version luceneVersion = Version.LUCENE_46;
+       private final Version luceneVersion = Version.LUCENE_5_5_2;
 
        private final File luceneDir;
 
@@ -201,8 +201,8 @@ public class TicketIndexer {
        public boolean deleteAll(RepositoryModel repository) {
                try {
                        IndexWriter writer = getWriter();
-                       StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
-                       QueryParser qp = new QueryParser(luceneVersion, Lucene.rid.name(), analyzer);
+                       StandardAnalyzer analyzer = new StandardAnalyzer();
+                       QueryParser qp = new QueryParser(Lucene.rid.name(), analyzer);
                        BooleanQuery query = new BooleanQuery();
                        query.add(qp.parse(repository.getRID()), Occur.MUST);
 
@@ -287,8 +287,8 @@ public class TicketIndexer {
         * @return true, if deleted, false if no record was deleted
         */
        private boolean delete(String repository, long ticketId, IndexWriter writer) throws Exception {
-               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
-               QueryParser qp = new QueryParser(luceneVersion, Lucene.did.name(), analyzer);
+               StandardAnalyzer analyzer = new StandardAnalyzer();
+               QueryParser qp = new QueryParser(Lucene.did.name(), analyzer);
                BooleanQuery query = new BooleanQuery();
                query.add(qp.parse(StringUtils.getSHA1(repository + ticketId)), Occur.MUST);
 
@@ -331,21 +331,21 @@ public class TicketIndexer {
                        return Collections.emptyList();
                }
                Set<QueryResult> results = new LinkedHashSet<QueryResult>();
-               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
+               StandardAnalyzer analyzer = new StandardAnalyzer();
                try {
                        // search the title, description and content
                        BooleanQuery query = new BooleanQuery();
                        QueryParser qp;
 
-                       qp = new QueryParser(luceneVersion, Lucene.title.name(), analyzer);
+                       qp = new QueryParser(Lucene.title.name(), analyzer);
                        qp.setAllowLeadingWildcard(true);
                        query.add(qp.parse(text), Occur.SHOULD);
 
-                       qp = new QueryParser(luceneVersion, Lucene.body.name(), analyzer);
+                       qp = new QueryParser(Lucene.body.name(), analyzer);
                        qp.setAllowLeadingWildcard(true);
                        query.add(qp.parse(text), Occur.SHOULD);
 
-                       qp = new QueryParser(luceneVersion, Lucene.content.name(), analyzer);
+                       qp = new QueryParser(Lucene.content.name(), analyzer);
                        qp.setAllowLeadingWildcard(true);
                        query.add(qp.parse(text), Occur.SHOULD);
 
@@ -354,7 +354,7 @@ public class TicketIndexer {
 
                        log.debug(rewrittenQuery.toString());
 
-                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000, true);
+                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000);
                        searcher.search(rewrittenQuery, collector);
                        int offset = Math.max(0, (page - 1) * pageSize);
                        ScoreDoc[] hits = collector.topDocs(offset, pageSize).scoreDocs;
@@ -392,9 +392,9 @@ public class TicketIndexer {
                }
 
                Set<QueryResult> results = new LinkedHashSet<QueryResult>();
-               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
+               StandardAnalyzer analyzer = new StandardAnalyzer();
                try {
-                       QueryParser qp = new QueryParser(luceneVersion, Lucene.content.name(), analyzer);
+                       QueryParser qp = new QueryParser(Lucene.content.name(), analyzer);
                        Query query = qp.parse(queryText);
 
                        IndexSearcher searcher = getSearcher();
@@ -443,14 +443,14 @@ public class TicketIndexer {
 
        private IndexWriter getWriter() throws IOException {
                if (writer == null) {
-                       Directory directory = FSDirectory.open(luceneDir);
+                       Directory directory = FSDirectory.open(luceneDir.toPath());
 
                        if (!luceneDir.exists()) {
                                luceneDir.mkdirs();
                        }
 
-                       StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
-                       IndexWriterConfig config = new IndexWriterConfig(luceneVersion, analyzer);
+                       StandardAnalyzer analyzer = new StandardAnalyzer();
+                       IndexWriterConfig config = new IndexWriterConfig(analyzer);
                        config.setOpenMode(OpenMode.CREATE_OR_APPEND);
                        writer = new IndexWriter(directory, config);
                }