Default to the EnglishAnalyzer
These IndexConfiguration.* thingers can probably be derived from the Indexer, so FIXME maybe.
- Id
- 45fcea3768d1d26979576861772b574e52ec5861
- Author
- Caio
- Commit time
- 2019-02-09T10:05:03+01:00
Modified pom.xml
</dependency>
<dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers-common</artifactId>
+ <version>${lucene.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>${flatbuffers.version}</version>
Modified src/main/java/co/caio/cerberus/search/IndexConfiguration.java
package co.caio.cerberus.search;
import static co.caio.cerberus.search.IndexField.*;
import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.facet.FacetsConfig;
public class IndexConfiguration {
private static final FacetsConfig facetsConfig;
+ public static final Analyzer DEFAULT_ANALYZER = new EnglishAnalyzer();
static {
facetsConfig = new FacetsConfig();
Modified src/main/java/co/caio/cerberus/search/Indexer.java
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.facet.FacetField;
public Indexer build() {
if (analyzer == null) {
- analyzer = new StandardAnalyzer();
+ analyzer = IndexConfiguration.DEFAULT_ANALYZER;
}
if (writerConfig == null) {
Modified src/main/java/co/caio/cerberus/search/QueryInterpreter.java
private final FulltextQueryParser queryParser;
QueryInterpreter(MoreLikeThis mlt) {
- analyzer = new StandardAnalyzer();
+ analyzer = IndexConfiguration.DEFAULT_ANALYZER;
facetsConfig = IndexConfiguration.getFacetsConfig();
moreLikeThis = mlt;