diff options
author | James Moger <james.moger@gitblit.com> | 2015-09-18 07:54:46 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2015-09-18 07:54:46 -0400 |
commit | 60110f769bb442494f6472d5ff3e39d596bf4130 (patch) | |
tree | c7319eff1a9161d9bf82989d7495d6a5b5e25f74 /src/main/java/com/gitblit/service | |
parent | 55c385e96e6594ec1ac3b5cd41ccd2df6048b696 (diff) | |
download | gitblit-60110f769bb442494f6472d5ff3e39d596bf4130.tar.gz gitblit-60110f769bb442494f6472d5ff3e39d596bf4130.zip |
Revert "Merge pull request #915 from lucamilanesio/lucene-5.2.1"
This reverts commit 55c385e96e6594ec1ac3b5cd41ccd2df6048b696, reversing
changes made to 61bb29d492ca9c34471ec0a119d1445ccde086e9.
Diffstat (limited to 'src/main/java/com/gitblit/service')
-rw-r--r-- | src/main/java/com/gitblit/service/LuceneService.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/com/gitblit/service/LuceneService.java b/src/main/java/com/gitblit/service/LuceneService.java index 59b1ff24..097a39b2 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();
+ writers.get(writer).close(true);
} 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();
- QueryParser qp = new QueryParser(FIELD_SUMMARY, analyzer);
+ StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
+ QueryParser qp = new QueryParser(LUCENE_VERSION, 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.toPath());
+ Directory directory = FSDirectory.open(indexFolder);
if (indexWriter == null) {
if (!indexFolder.exists()) {
indexFolder.mkdirs();
}
- StandardAnalyzer analyzer = new StandardAnalyzer();
- IndexWriterConfig config = new IndexWriterConfig(analyzer);
+ StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
+ IndexWriterConfig config = new IndexWriterConfig(LUCENE_VERSION, 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();
+ StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
try {
// default search checks summary and content
BooleanQuery query = new BooleanQuery();
QueryParser qp;
- qp = new QueryParser(FIELD_SUMMARY, analyzer);
+ qp = new QueryParser(LUCENE_VERSION, FIELD_SUMMARY, analyzer);
qp.setAllowLeadingWildcard(true);
query.add(qp.parse(text), Occur.SHOULD);
- qp = new QueryParser(FIELD_CONTENT, analyzer);
+ qp = new QueryParser(LUCENE_VERSION, 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);
+ 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;
@@ -1225,7 +1225,7 @@ public class LuceneService implements Runnable { */
private class MultiSourceReader extends MultiReader {
- MultiSourceReader(IndexReader [] readers) throws IOException {
+ MultiSourceReader(IndexReader [] readers) {
super(readers, false);
}
|