use of org.apache.lucene.search.BooleanQuery.TooManyClauses in project lucene-solr by apache.
the class AnyQueryNodeBuilder method build.
@Override
public BooleanQuery build(QueryNode queryNode) throws QueryNodeException {
AnyQueryNode andNode = (AnyQueryNode) queryNode;
BooleanQuery.Builder bQuery = new BooleanQuery.Builder();
List<QueryNode> children = andNode.getChildren();
if (children != null) {
for (QueryNode child : children) {
Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
if (obj != null) {
Query query = (Query) obj;
try {
bQuery.add(query, BooleanClause.Occur.SHOULD);
} catch (TooManyClauses ex) {
throw new QueryNodeException(new MessageImpl(/*
* IQQQ.Q0028E_TOO_MANY_BOOLEAN_CLAUSES,
* BooleanQuery.getMaxClauseCount()
*/
QueryParserMessages.EMPTY_MESSAGE), ex);
}
}
}
}
bQuery.setMinimumNumberShouldMatch(andNode.getMinimumMatchingElements());
return bQuery.build();
}
use of org.apache.lucene.search.BooleanQuery.TooManyClauses in project lucene-solr by apache.
the class BooleanQueryNodeBuilder method build.
@Override
public BooleanQuery build(QueryNode queryNode) throws QueryNodeException {
BooleanQueryNode booleanNode = (BooleanQueryNode) queryNode;
BooleanQuery.Builder bQuery = new BooleanQuery.Builder();
List<QueryNode> children = booleanNode.getChildren();
if (children != null) {
for (QueryNode child : children) {
Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
if (obj != null) {
Query query = (Query) obj;
try {
bQuery.add(query, getModifierValue(child));
} catch (TooManyClauses ex) {
throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), queryNode.toQueryString(new EscapeQuerySyntaxImpl())), ex);
}
}
}
}
return bQuery.build();
}
Aggregations