]> source.dussan.org Git - gitblit.git/commitdiff
Bump to Lucene 5.2.1 915/head
authorLuca Milanesio <luca.milanesio@gmail.com>
Wed, 9 Sep 2015 16:00:05 +0000 (17:00 +0100)
committerLuca Milanesio <luca.milanesio@gmail.com>
Wed, 9 Sep 2015 16:00:05 +0000 (17:00 +0100)
.classpath
build.moxie
gitblit.iml
src/main/java/com/gitblit/service/LuceneService.java
src/main/java/com/gitblit/tickets/TicketIndexer.java

index bd0b4372ca83733d1dcaf810359e62c283e6708f..b31b70c284ce5d5974b7293b9bc10dc7bac1a154 100644 (file)
        <classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar" />
        <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar" />
        <classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar" />
-       <classpathentry kind="lib" path="ext/lucene-core-4.10.0.jar" sourcepath="ext/src/lucene-core-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-analyzers-common-4.10.0.jar" sourcepath="ext/src/lucene-analyzers-common-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-highlighter-4.10.0.jar" sourcepath="ext/src/lucene-highlighter-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-memory-4.10.0.jar" sourcepath="ext/src/lucene-memory-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-queries-4.10.0.jar" sourcepath="ext/src/lucene-queries-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-queryparser-4.10.0.jar" sourcepath="ext/src/lucene-queryparser-4.10.0.jar" />
-       <classpathentry kind="lib" path="ext/lucene-sandbox-4.10.0.jar" sourcepath="ext/src/lucene-sandbox-4.10.0.jar" />
+       <classpathentry kind="lib" path="ext/lucene-core-5.2.1.jar" sourcepath="ext/src/lucene-core-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-analyzers-common-5.2.1.jar" sourcepath="ext/src/lucene-analyzers-common-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-highlighter-5.2.1.jar" sourcepath="ext/src/lucene-highlighter-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-join-5.2.1.jar" sourcepath="ext/src/lucene-join-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-grouping-5.2.1.jar" sourcepath="ext/src/lucene-grouping-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-queries-5.2.1.jar" sourcepath="ext/src/lucene-queries-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-memory-5.2.1.jar" sourcepath="ext/src/lucene-memory-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-queryparser-5.2.1.jar" sourcepath="ext/src/lucene-queryparser-5.2.1.jar" />
+       <classpathentry kind="lib" path="ext/lucene-sandbox-5.2.1.jar" sourcepath="ext/src/lucene-sandbox-5.2.1.jar" />
        <classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
        <classpathentry kind="lib" path="ext/pegdown-1.4.2.jar" sourcepath="ext/src/pegdown-1.4.2.jar" />
        <classpathentry kind="lib" path="ext/parboiled-java-1.1.6.jar" sourcepath="ext/src/parboiled-java-1.1.6.jar" />
index 311e26dfd174436d42d290f6ec3da8dac18d82ba..1cfd9b855fe8ab20c5142329bbb1ed73c3a4b064 100644 (file)
@@ -105,7 +105,7 @@ properties: {
   jetty.version  : 9.2.10.v20150310
   slf4j.version  : 1.7.10
   wicket.version : 1.4.21
-  lucene.version : 4.10.0
+  lucene.version : 5.2.1
   jgit.version   : 4.0.1.201506240215-r
   groovy.version : 2.4.1
   bouncycastle.version : 1.51
index 343f24e4697bafa88a83bfcd65d472245b997e69..247220bf4273381b796079dc83b7890cac59aea6 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-core-4.10.0.jar">
+      <library name="lucene-core-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-core-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-core-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-analyzers-common-4.10.0.jar">
+      <library name="lucene-analyzers-common-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-highlighter-4.10.0.jar">
+      <library name="lucene-highlighter-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-memory-4.10.0.jar">
+      <library name="lucene-join-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-memory-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-join-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-join-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-queries-4.10.0.jar">
+      <library name="lucene-grouping-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-queries-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-grouping-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-grouping-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-queryparser-4.10.0.jar">
+      <library name="lucene-queries-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-queries-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-5.2.1.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-sandbox-4.10.0.jar">
+      <library name="lucene-memory-5.2.1.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-memory-5.2.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-4.10.0.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-5.2.1.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="lucene-queryparser-5.2.1.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-5.2.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-5.2.1.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="lucene-sandbox-5.2.1.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-5.2.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-5.2.1.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..ad8ea23932b8bc29b35ddf88752f909eff9e0819 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_2_1;
 
        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);
                }