diff options
author | Luca Milanesio <luca.milanesio@gmail.com> | 2016-12-22 00:42:56 +0000 |
---|---|---|
committer | Florian Zschocke <florian.zschocke@devolo.de> | 2017-03-05 20:20:57 +0100 |
commit | 2e03db322ea93cac67275bdd584a67b559ed185a (patch) | |
tree | e9ec908d649f975a00f676dc850baa7248cd9023 | |
parent | 71211a8cdfae8d528130cedf3e67d21e130ee8a0 (diff) | |
download | gitblit-2e03db322ea93cac67275bdd584a67b559ed185a.tar.gz gitblit-2e03db322ea93cac67275bdd584a67b559ed185a.zip |
Bump to Lucene 5.5.2
-rw-r--r-- | .classpath | 14 | ||||
-rw-r--r-- | build.moxie | 2 | ||||
-rw-r--r-- | gitblit.iml | 42 | ||||
-rw-r--r-- | src/main/java/com/gitblit/service/LuceneService.java | 22 | ||||
-rw-r--r-- | src/main/java/com/gitblit/tickets/TicketIndexer.java | 30 |
5 files changed, 55 insertions, 55 deletions
@@ -21,13 +21,13 @@ <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" /> diff --git a/build.moxie b/build.moxie index eb05e2c8..9e5da709 100644 --- a/build.moxie +++ b/build.moxie @@ -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 diff --git a/gitblit.iml b/gitblit.iml index 038c4f4d..aefea941 100644 --- a/gitblit.iml +++ b/gitblit.iml @@ -180,79 +180,79 @@ </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> diff --git a/src/main/java/com/gitblit/service/LuceneService.java b/src/main/java/com/gitblit/service/LuceneService.java index 097a39b2..59b1ff24 100644 --- a/src/main/java/com/gitblit/service/LuceneService.java +++ b/src/main/java/com/gitblit/service/LuceneService.java @@ -267,7 +267,7 @@ public class LuceneService implements Runnable { // close all writers
for (String writer : writers.keySet()) {
try {
- writers.get(writer).close(true);
+ writers.get(writer).close();
} catch (Throwable t) {
logger.error("Failed to close Lucene writer for " + writer, t);
}
@@ -722,8 +722,8 @@ public class LuceneService implements Runnable { String q = MessageFormat.format(pattern, SearchObjectType.blob.name(), branch, path);
BooleanQuery query = new BooleanQuery();
- StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
- QueryParser qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);
+ StandardAnalyzer analyzer = new StandardAnalyzer();
+ QueryParser qp = new QueryParser(FIELD_SUMMARY, analyzer);
query.add(qp.parse(q), Occur.MUST);
IndexWriter writer = getIndexWriter(repositoryName);
@@ -968,14 +968,14 @@ public class LuceneService implements Runnable { IndexWriter indexWriter = writers.get(repository);
File repositoryFolder = FileKey.resolve(new File(repositoriesFolder, repository), FS.DETECTED);
File indexFolder = new File(repositoryFolder, LUCENE_DIR);
- Directory directory = FSDirectory.open(indexFolder);
+ Directory directory = FSDirectory.open(indexFolder.toPath());
if (indexWriter == null) {
if (!indexFolder.exists()) {
indexFolder.mkdirs();
}
- StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
- IndexWriterConfig config = new IndexWriterConfig(LUCENE_VERSION, analyzer);
+ StandardAnalyzer analyzer = new StandardAnalyzer();
+ IndexWriterConfig config = new IndexWriterConfig(analyzer);
config.setOpenMode(OpenMode.CREATE_OR_APPEND);
indexWriter = new IndexWriter(directory, config);
writers.put(repository, indexWriter);
@@ -1028,16 +1028,16 @@ public class LuceneService implements Runnable { return null;
}
Set<SearchResult> results = new LinkedHashSet<SearchResult>();
- StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
+ StandardAnalyzer analyzer = new StandardAnalyzer();
try {
// default search checks summary and content
BooleanQuery query = new BooleanQuery();
QueryParser qp;
- qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);
+ qp = new QueryParser(FIELD_SUMMARY, analyzer);
qp.setAllowLeadingWildcard(true);
query.add(qp.parse(text), Occur.SHOULD);
- qp = new QueryParser(LUCENE_VERSION, FIELD_CONTENT, analyzer);
+ qp = new QueryParser(FIELD_CONTENT, analyzer);
qp.setAllowLeadingWildcard(true);
query.add(qp.parse(text), Occur.SHOULD);
@@ -1060,7 +1060,7 @@ public class LuceneService implements Runnable { Query rewrittenQuery = searcher.rewrite(query);
logger.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;
@@ -1225,7 +1225,7 @@ public class LuceneService implements Runnable { */
private class MultiSourceReader extends MultiReader {
- MultiSourceReader(IndexReader [] readers) {
+ MultiSourceReader(IndexReader [] readers) throws IOException {
super(readers, false);
}
diff --git a/src/main/java/com/gitblit/tickets/TicketIndexer.java b/src/main/java/com/gitblit/tickets/TicketIndexer.java index e2d53af7..02af25ef 100644 --- a/src/main/java/com/gitblit/tickets/TicketIndexer.java +++ b/src/main/java/com/gitblit/tickets/TicketIndexer.java @@ -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); } |