use of org.apache.lucene.analysis.StopwordAnalyzerBase in project neo4j by neo4j.
the class AnalyzerProvider method stopwords.
public List<String> stopwords() {
Analyzer analyzer = createAnalyzer();
if (analyzer instanceof StopwordAnalyzerBase) {
StopwordAnalyzerBase stopwordAnalyzer = (StopwordAnalyzerBase) analyzer;
CharArraySet stopwords = stopwordAnalyzer.getStopwordSet();
return stopwords.stream().map(obj -> new String((char[]) obj)).collect(Collectors.toList());
}
return List.of();
}
use of org.apache.lucene.analysis.StopwordAnalyzerBase in project xodus by JetBrains.
the class ExodusLuceneTestsBase method removeStopWord.
protected void removeStopWord(final String stopWord) {
final HashSet<Object> stopSet = new HashSet<>();
for (Object word : ((StopwordAnalyzerBase) analyzer).getStopwordSet()) {
if (!stopWord.equals(new String((char[]) word))) {
stopSet.add(word);
}
}
analyzer = new EnglishAnalyzer(LUCENE_VERSION, stopSet);
}
Aggregations