<commit_before>package com.jivesoftware.os.miru.plugin.query;

import com.google.common.collect.Lists;
import com.jivesoftware.os.miru.api.field.MiruFieldType;
import com.jivesoftware.os.miru.api.query.filter.MiruFieldFilter;
import com.jivesoftware.os.miru.api.query.filter.MiruFilter;
import com.jivesoftware.os.miru.api.query.filter.MiruFilterOperation;
import java.util.Collections;
import java.util.List;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;

/**
 * Due to its reliance on the Lucene {@link QueryParser}, this class is NOT thread-safe.
 */
public class LuceneBackedQueryParser implements MiruQueryParser {

    private final QueryParser parser;

    public LuceneBackedQueryParser(String defaultField) {
        this.parser = new QueryParser(defaultField, new MiruBodyAnalyzer());
    }

    @Override
    public MiruFilter parse(String queryString) throws Exception {
        return makeFilter(parser.parse(queryString));
    }
<commit_msg>snowball stemmer<commit_after>package com.jivesoftware.os.miru.plugin.query;

import com.google.common.collect.Lists;
import com.jivesoftware.os.miru.api.field.MiruFieldType;
import com.jivesoftware.os.miru.api.query.filter.MiruFieldFilter;
import com.jivesoftware.os.miru.api.query.filter.MiruFilter;
import com.jivesoftware.os.miru.api.query.filter.MiruFilterOperation;
import java.util.Collections;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.snowball.SnowballAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.Version;

/**
 * Due to its reliance on the Lucene {@link QueryParser}, this class is NOT thread-safe.
 */
public class LuceneBackedQueryParser implements MiruQueryParser {

    private final QueryParser parser;
    //TODO it would be lovely if this was passed in
    private final Analyzer analyzer = new SnowballAnalyzer(Version.LUCENE_4_10_3, "English", StandardAnalyzer.STOP_WORDS_SET);

    public LuceneBackedQueryParser(String defaultField) {
        this.parser = new QueryParser(defaultField, analyzer);
    }

    @Override
    public MiruFilter parse(String queryString) throws Exception {
        return makeFilter(parser.parse(queryString));
    }

{'fraction_non_alphanumeric': 0.09925558312655088, 'fraction_numerical': 0.0014179369018078695, 'mean_word_length': 5.1347826086956525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6725256', 'n_tokens_mistral': 904, 'n_tokens_neox': 871, 'n_words': 166}