@@ -0,0 +1,2707 @@
+package buzztaiki.lucene.lastuni;%0A%0Aimport org.apache.lucene.index.Term;%0Aimport org.apache.lucene.queryParser.ParseException;%0Aimport org.apache.lucene.queryParser.QueryParser;%0Aimport org.apache.lucene.search.Query;%0Aimport org.apache.solr.common.params.CommonParams;%0Aimport org.apache.solr.common.params.SolrParams;%0Aimport org.apache.solr.request.SolrQueryRequest;%0Aimport org.apache.solr.search.LuceneQParserPlugin;%0Aimport org.apache.solr.search.QParser;%0Aimport org.apache.solr.search.QueryParsing;%0Aimport org.apache.solr.search.SolrQueryParser;%0A%0A/**%0A * %5BWIP%5D A Solr QueryParser Plugin that support %7B@link CJKSingleCharQuery%7D.%0A */%0Apublic class CJKSingleCharSupportQParserPlugin extends LuceneQParserPlugin %7B%0A    public static String NAME = %22cjksingle%22;%0A%0A    @Override%0A    public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) %7B%0A        return new LocalQParser(qstr, localParams, params, req);%0A    %7D%0A    %0A    private static class LocalQParser extends QParser %7B%0A        public LocalQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) %7B%0A            super(qstr, localParams, params, req);%0A        %7D%0A    %0A        @Override%0A        public Query parse() throws ParseException %7B%0A            String qstr = getString();%0A%0A            String defaultField = getParam(CommonParams.DF);%0A            if (defaultField==null) %7B%0A                defaultField = getReq().getSchema().getDefaultSearchFieldName();%0A            %7D%0A            SolrQueryParser lparser = new LocalQueryParser(this, defaultField);%0A%0A            // these could either be checked & set here, or in the SolrQueryParser constructor%0A            String opParam = getParam(QueryParsing.OP);%0A            if (opParam != null) %7B%0A                lparser.setDefaultOperator(%22AND%22.equals(opParam) ? QueryParser.Operator.AND : QueryParser.Operator.OR);%0A            %7D else %7B%0A                // try to get default operator from schema%0A                QueryParser.Operator operator = getReq().getSchema().getSolrQueryParser(null).getDefaultOperator();%0A                lparser.setDefaultOperator(null == operator ? QueryParser.Operator.OR : operator);%0A            %7D%0A%0A            return lparser.parse(qstr);%0A        %7D%0A    %7D%0A%0A%0A    private static class LocalQueryParser extends SolrQueryParser %7B%0A        public LocalQueryParser(QParser parser, String defaultField) %7B%0A            super(parser, defaultField);%0A        %7D%0A%0A        @Override%0A        public Query newTermQuery(Term term) %7B%0A            if (CJKSingleCharQuery.allowed(term)) %7B%0A                return CJKSingleCharQuery.of(term);%0A            %7D else %7B%0A                return super.newTermQuery(term);%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Add Solr QParserPlugin (WIP)