Package org.apache.lucene.queryParser

Examples of org.apache.lucene.queryParser.MultiFieldQueryParserSettings.defaultField()


        }

        MapperQueryParser queryParser;
        if (qpSettings.fields() != null) {
            if (qpSettings.fields().size() == 1) {
                qpSettings.defaultField(qpSettings.fields().get(0));
                queryParser = parseContext.singleQueryParser(qpSettings);
            } else {
                qpSettings.defaultField(null); // reset defaultField when using multi query parser
                queryParser = parseContext.multiQueryParser(qpSettings);
            }
View Full Code Here


        if (qpSettings.fields() != null) {
            if (qpSettings.fields().size() == 1) {
                qpSettings.defaultField(qpSettings.fields().get(0));
                queryParser = parseContext.singleQueryParser(qpSettings);
            } else {
                qpSettings.defaultField(null); // reset defaultField when using multi query parser
                queryParser = parseContext.multiQueryParser(qpSettings);
            }
        } else {
            queryParser = parseContext.singleQueryParser(qpSettings);
        }
View Full Code Here

    @Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
        XContentParser parser = parseContext.parser();

        MultiFieldQueryParserSettings qpSettings = new MultiFieldQueryParserSettings();
        qpSettings.defaultField(AllFieldMapper.NAME);

        String currentFieldName = null;
        XContentParser.Token token;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
View Full Code Here

                }
            } else if (token.isValue()) {
                if ("query".equals(currentFieldName)) {
                    qpSettings.queryString(parser.text());
                } else if ("default_field".equals(currentFieldName) || "defaultField".equals(currentFieldName)) {
                    qpSettings.defaultField(parseContext.indexName(parser.text()));
                } else if ("default_operator".equals(currentFieldName) || "defaultOperator".equals(currentFieldName)) {
                    String op = parser.text();
                    if ("or".equalsIgnoreCase(op)) {
                        qpSettings.defaultOperator(org.apache.lucene.queryParser.QueryParser.Operator.OR);
                    } else if ("and".equalsIgnoreCase(op)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.