Example usage for org.apache.lucene.queryparser.flexible.core.nodes BooleanQueryNode BooleanQueryNode

List of usage examples for org.apache.lucene.queryparser.flexible.core.nodes BooleanQueryNode BooleanQueryNode

Introduction

In this page you can find the example usage for org.apache.lucene.queryparser.flexible.core.nodes BooleanQueryNode BooleanQueryNode.

Prototype

public BooleanQueryNode(List<QueryNode> clauses) 

Source Link

Usage

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

License:Open Source License

public QueryNode process(QueryNode queryTree) throws QueryNodeException {
    if (!this.getQueryConfigHandler().has(ConfigurationKeys.DEFAULT_OPERATOR)) {
        throw new IllegalArgumentException("DEFAULT_OPERATOR should be set on the QueryConfigHandler");
    }//w  ww . j av  a 2 s. c o m

    this.usingAnd = Operator.AND == this.getQueryConfigHandler().get(ConfigurationKeys.DEFAULT_OPERATOR) ? true
            : false;

    if (queryTree instanceof GroupQueryNode) {
        queryTree = ((GroupQueryNode) queryTree).getChild();
    }

    this.queryNodeList = new ArrayList<QueryNode>();
    this.latestNodeVerified = false;
    this.readTree(queryTree);

    if (queryTree instanceof BooleanQueryNode) {
        queryTree.set(this.queryNodeList);
        return queryTree;
    } else {
        return new BooleanQueryNode(this.queryNodeList);
    }

}

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

License:Open Source License

@Override
public QueryNode process(final QueryNode queryTree) throws QueryNodeException {
    final TopLevelQueryNode top = (TopLevelQueryNode) queryTree;

    if (this.getQueryConfigHandler().has(KeywordConfigurationKeys.ALLOW_TWIG)) {
        if (!this.getQueryConfigHandler().get(KeywordConfigurationKeys.ALLOW_TWIG)) {
            // Wraps the children into a BooleanQueryNode, so that the parent
            // pointers are correct.
            // This relies on the BooleanSingleChildOptimizationQueryNodeProcessor
            return new BooleanQueryNode(top.getChildren());
        }/*from ww  w . j a v  a  2 s. c om*/
    } else {
        throw new IllegalArgumentException(
                "KeywordConfigurationKeys.ALLOW_TWIG should be set on the ExtendedKeywordQueryConfigHandler");
    }
    return queryTree;
}

From source file:org.sindice.siren.qparser.keyword.processors.TopLevelQueryNodeProcessor.java

License:Apache License

@Override
public QueryNode process(final QueryNode queryTree) throws QueryNodeException {
    final TopLevelQueryNode top = (TopLevelQueryNode) queryTree;

    if (this.getQueryConfigHandler().has(KeywordConfigurationKeys.ALLOW_TWIG)) {
        if (!this.getQueryConfigHandler().get(KeywordConfigurationKeys.ALLOW_TWIG)) {
            // Wraps the children into a BooleanQueryNode, so that the parent
            // pointers are correct.
            // This relies on the BooleanSingleChildOptimizationQueryNodeProcessor
            return new BooleanQueryNode(top.getChildren());
        }//from w ww  . j a  v a 2 s. c  o m
    } else {
        throw new IllegalArgumentException(
                "KeywordConfigurationKeys.ALLOW_TWIG should be set on the KeywordQueryConfigHandler");
    }
    return queryTree;
}