Skip to content

Commit

Permalink
make changes to adapt to new Lucene 7.0.0 design
Browse files Browse the repository at this point in the history
Change-Id: I1053765276f25368023a499dd0e52556d94d62ce
Signed-off-by: Florent BENOIT <[email protected]>
  • Loading branch information
benoitf committed Nov 2, 2017
1 parent 7baa22a commit 69ecbbe
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import java.util.concurrent.ExecutorService;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
import org.apache.lucene.analysis.core.WhitespaceTokenizerFactory;
import org.apache.lucene.analysis.custom.CustomAnalyzer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.document.Document;
Expand Down Expand Up @@ -121,15 +121,11 @@ public boolean removeIndexFilter(VirtualFileFilter indexFilter) {
return excludeFileIndexFilters.remove(indexFilter);
}

protected Analyzer makeAnalyzer() {
return new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName) {
Tokenizer tokenizer = new WhitespaceTokenizer();
TokenStream filter = new LowerCaseFilter(tokenizer);
return new TokenStreamComponents(tokenizer, filter);
}
};
protected Analyzer makeAnalyzer() throws IOException {
return CustomAnalyzer.builder()
.withTokenizer(WhitespaceTokenizerFactory.class)
.addTokenFilter(LowerCaseFilterFactory.class)
.build();
}

protected abstract Directory makeDirectory() throws ServerException;
Expand Down Expand Up @@ -319,7 +315,7 @@ public SearchResult search(QueryExpression query) throws ServerException {
}
}

private Query createLuceneQuery(QueryExpression query) throws ParseException {
private Query createLuceneQuery(QueryExpression query) throws ParseException, IOException {
BooleanQuery.Builder luceneQueryBuilder = new BooleanQuery.Builder();
final String name = query.getName();
final String path = query.getPath();
Expand Down

0 comments on commit 69ecbbe

Please sign in to comment.