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/tickets | |
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/tickets')
-rw-r--r-- | src/main/java/com/gitblit/tickets/TicketIndexer.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main/java/com/gitblit/tickets/TicketIndexer.java b/src/main/java/com/gitblit/tickets/TicketIndexer.java index ad8ea239..e2d53af7 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_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); } |