]> source.dussan.org Git - gitblit.git/commitdiff
Revert "Merge pull request #915 from lucamilanesio/lucene-5.2.1"
authorJames Moger <james.moger@gitblit.com>
Fri, 18 Sep 2015 11:54:46 +0000 (07:54 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 18 Sep 2015 11:54:46 +0000 (07:54 -0400)
This reverts commit 55c385e96e6594ec1ac3b5cd41ccd2df6048b696, reversing
changes made to 61bb29d492ca9c34471ec0a119d1445ccde086e9.

.classpath
build.moxie
gitblit.iml
src/main/java/com/gitblit/service/LuceneService.java
src/main/java/com/gitblit/tickets/TicketIndexer.java

index b31b70c284ce5d5974b7293b9bc10dc7bac1a154..bd0b4372ca83733d1dcaf810359e62c283e6708f 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-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/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/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 1cfd9b855fe8ab20c5142329bbb1ed73c3a4b064..311e26dfd174436d42d290f6ec3da8dac18d82ba 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 : 5.2.1
+  lucene.version : 4.10.0
   jgit.version   : 4.0.1.201506240215-r
   groovy.version : 2.4.1
   bouncycastle.version : 1.51
index 247220bf4273381b796079dc83b7890cac59aea6..343f24e4697bafa88a83bfcd65d472245b997e69 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-core-5.2.1.jar">
+      <library name="lucene-core-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-core-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-core-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-core-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-analyzers-common-5.2.1.jar">
+      <library name="lucene-analyzers-common-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-highlighter-5.2.1.jar">
+      <library name="lucene-highlighter-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-join-5.2.1.jar">
+      <library name="lucene-memory-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-join-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-memory-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-join-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-grouping-5.2.1.jar">
+      <library name="lucene-queries-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-grouping-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-queries-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-grouping-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-queries-5.2.1.jar">
+      <library name="lucene-queryparser-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-queries-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="lucene-memory-5.2.1.jar">
+      <library name="lucene-sandbox-4.10.0.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/lucene-memory-5.2.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-4.10.0.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <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!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-4.10.0.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
index 59b1ff248ebd4ba82c1d3720e10b44a1bcb8b4aa..097a39b2f3e11750a180154f6cfe2385c19a3889 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();\r
+                               writers.get(writer).close(true);\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();\r
-               QueryParser qp = new QueryParser(FIELD_SUMMARY, analyzer);\r
+               StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
+               QueryParser qp = new QueryParser(LUCENE_VERSION, 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.toPath());\r
+               Directory directory = FSDirectory.open(indexFolder);\r
 \r
                if (indexWriter == null) {\r
                        if (!indexFolder.exists()) {\r
                                indexFolder.mkdirs();\r
                        }\r
-                       StandardAnalyzer analyzer = new StandardAnalyzer();\r
-                       IndexWriterConfig config = new IndexWriterConfig(analyzer);\r
+                       StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
+                       IndexWriterConfig config = new IndexWriterConfig(LUCENE_VERSION, 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();\r
+               StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);\r
                try {\r
                        // default search checks summary and content\r
                        BooleanQuery query = new BooleanQuery();\r
                        QueryParser qp;\r
-                       qp = new QueryParser(FIELD_SUMMARY, analyzer);\r
+                       qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);\r
                        qp.setAllowLeadingWildcard(true);\r
                        query.add(qp.parse(text), Occur.SHOULD);\r
 \r
-                       qp = new QueryParser(FIELD_CONTENT, analyzer);\r
+                       qp = new QueryParser(LUCENE_VERSION, 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);\r
+                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000, true);\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) throws IOException {\r
+               MultiSourceReader(IndexReader [] readers) {\r
                        super(readers, false);\r
                }\r
 \r
index ad8ea23932b8bc29b35ddf88752f909eff9e0819..e2d53af7b6d2fe082d30d1031006e35477954a33 100644 (file)
@@ -167,7 +167,7 @@ public class TicketIndexer {
 
        private final Logger log = LoggerFactory.getLogger(getClass());
 
-       private final Version luceneVersion = Version.LUCENE_5_2_1;
+       private final Version luceneVersion = Version.LUCENE_46;
 
        private final File luceneDir;
 
@@ -201,8 +201,8 @@ public class TicketIndexer {
        public boolean deleteAll(RepositoryModel repository) {
                try {
                        IndexWriter writer = getWriter();
-                       StandardAnalyzer analyzer = new StandardAnalyzer();
-                       QueryParser qp = new QueryParser(Lucene.rid.name(), analyzer);
+                       StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
+                       QueryParser qp = new QueryParser(luceneVersion, 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();
-               QueryParser qp = new QueryParser(Lucene.did.name(), analyzer);
+               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
+               QueryParser qp = new QueryParser(luceneVersion, 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();
+               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
                try {
                        // search the title, description and content
                        BooleanQuery query = new BooleanQuery();
                        QueryParser qp;
 
-                       qp = new QueryParser(Lucene.title.name(), analyzer);
+                       qp = new QueryParser(luceneVersion, Lucene.title.name(), analyzer);
                        qp.setAllowLeadingWildcard(true);
                        query.add(qp.parse(text), Occur.SHOULD);
 
-                       qp = new QueryParser(Lucene.body.name(), analyzer);
+                       qp = new QueryParser(luceneVersion, Lucene.body.name(), analyzer);
                        qp.setAllowLeadingWildcard(true);
                        query.add(qp.parse(text), Occur.SHOULD);
 
-                       qp = new QueryParser(Lucene.content.name(), analyzer);
+                       qp = new QueryParser(luceneVersion, 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);
+                       TopScoreDocCollector collector = TopScoreDocCollector.create(5000, true);
                        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();
+               StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
                try {
-                       QueryParser qp = new QueryParser(Lucene.content.name(), analyzer);
+                       QueryParser qp = new QueryParser(luceneVersion, 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.toPath());
+                       Directory directory = FSDirectory.open(luceneDir);
 
                        if (!luceneDir.exists()) {
                                luceneDir.mkdirs();
                        }
 
-                       StandardAnalyzer analyzer = new StandardAnalyzer();
-                       IndexWriterConfig config = new IndexWriterConfig(analyzer);
+                       StandardAnalyzer analyzer = new StandardAnalyzer(luceneVersion);
+                       IndexWriterConfig config = new IndexWriterConfig(luceneVersion, analyzer);
                        config.setOpenMode(OpenMode.CREATE_OR_APPEND);
                        writer = new IndexWriter(directory, config);
                }