Example usage for org.apache.lucene.queryparser.flexible.core.config QueryConfigHandler has

List of usage examples for org.apache.lucene.queryparser.flexible.core.config QueryConfigHandler has

Introduction

In this page you can find the example usage for org.apache.lucene.queryparser.flexible.core.config QueryConfigHandler has.

Prototype

public <T> boolean has(ConfigurationKey<T> key) 

Source Link

Document

Returns true if there is a value set with the given key, otherwise false.

Usage

From source file:com.sindicetech.siren.qparser.keyword.processors.ChangeDefaultOperatorNodeProcessor.java

License:Open Source License

@Override
protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException {

    if (node.getParent() == null) { // node is root, we processed the tree
        if (hasUnaryReqOperator) { // we found a req modifier in the tree

            final QueryConfigHandler conf = this.getQueryConfigHandler();
            if (!conf.has(ConfigurationKeys.DEFAULT_OPERATOR)) {
                throw new IllegalArgumentException(
                        "ConfigurationKeys.DEFAULT_OPERATOR should be set on the QueryConfigHandler");
            }//from  www .  j  a v  a  2 s .c  o m
            conf.set(ConfigurationKeys.DEFAULT_OPERATOR, Operator.OR);
        }
    }
    return node;

}

From source file:com.sindicetech.siren.qparser.keyword.processors.DatatypeProcessor.java

License:Open Source License

public static String getDefaultDatatype(QueryConfigHandler config) {
    if (config.has(KeywordConfigurationKeys.DEFAULT_DATATYPE)) {
        return config.get(KeywordConfigurationKeys.DEFAULT_DATATYPE);
    } else {/*from w  w  w.  j ava  2 s  .c  om*/
        throw new IllegalArgumentException(
                "KeywordConfigurationKeys.DEFAULT_DATATYPE should be set on the ExtendedKeywordQueryConfigHandler");
    }
}