List of usage examples for org.apache.lucene.queryparser.flexible.core.messages QueryParserMessages TOO_MANY_BOOLEAN_CLAUSES
String TOO_MANY_BOOLEAN_CLAUSES
To view the source code for org.apache.lucene.queryparser.flexible.core.messages QueryParserMessages TOO_MANY_BOOLEAN_CLAUSES.
Click Source Link
From source file:com.sindicetech.siren.qparser.keyword.builders.BooleanQueryNodeBuilder.java
License:Open Source License
public Query build(final QueryNode queryNode) throws QueryNodeException { final BooleanQueryNode booleanNode = (BooleanQueryNode) queryNode; final BooleanQuery bQuery = new BooleanQuery(); final List<QueryNode> children = booleanNode.getChildren(); if (children != null) { for (final QueryNode child : children) { final Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { final Query query = (Query) obj; try { final QueryNode mod; if (child instanceof DatatypeQueryNode) { mod = ((DatatypeQueryNode) child).getChild(); } else { mod = child;//from w ww . ja va 2s .co m } bQuery.add(query, getModifierValue(mod)); } catch (final TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), queryNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } } } } return bQuery; }
From source file:com.sindicetech.siren.qparser.tree.builders.BooleanQueryNodeBuilder.java
License:Open Source License
private final BooleanSpanQuery buildBooleanSpanQuery(BooleanQueryNode booleanNode) throws QueryNodeException { // check if the node has a slop int slop = this.DEFAULT_SLOP; if (booleanNode.getTag(SlopPropertyParser.SLOP_PROPERTY) != null) { slop = (Integer) booleanNode.getTag(SlopPropertyParser.SLOP_PROPERTY); }// w w w.jav a 2 s .c om // check if the node has a inOrder flag boolean inOrder = this.DEFAULT_INORDER; if (booleanNode.getTag(InOrderPropertyParser.IN_ORDER_PROPERTY) != null) { int tag = (Integer) booleanNode.getTag(InOrderPropertyParser.IN_ORDER_PROPERTY); inOrder = tag == 0 ? false : true; } // build the query and add clauses final BooleanSpanQuery bsq = new BooleanSpanQuery(slop, inOrder); for (final QueryNode child : booleanNode.getChildren()) { final Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); try { bsq.add(new NodeSpanQuery((NodeQuery) obj), this.getNodeModifierValue(child)); } catch (final BooleanQuery.TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), booleanNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } } // check if the node has a node range constraint if (booleanNode.getTag(RangePropertyParser.RANGE_PROPERTY) != null) { final int[] range = (int[]) booleanNode.getTag(RangePropertyParser.RANGE_PROPERTY); bsq.setNodeConstraint(range[0], range[1]); } return bsq; }
From source file:com.sindicetech.siren.qparser.tree.builders.BooleanQueryNodeBuilder.java
License:Open Source License
private final BooleanQuery buildBooleanQuery(BooleanQueryNode booleanNode) throws QueryNodeException { // build the query and add clauses final BooleanQuery bq = new BooleanQuery(true); for (final QueryNode child : booleanNode.getChildren()) { final Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); try {/* w ww .j a va 2 s . c o m*/ Query q = (Query) obj; if (obj instanceof NodeQuery) { // wrap the query into a LuceneProxyNodeQuery q = new LuceneProxyNodeQuery((NodeQuery) q); } bq.add(q, this.getLuceneModifierValue(child)); } catch (final BooleanQuery.TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), booleanNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } } return bq; }
From source file:com.sindicetech.siren.qparser.tree.builders.TwigQueryNodeBuilder.java
License:Open Source License
@Override public TwigQuery build(final QueryNode queryNode) throws QueryNodeException { final TwigQueryNode twigNode = (TwigQueryNode) queryNode; final List<QueryNode> children = twigNode.getChildren(); final TwigQuery query = new TwigQuery(); // check if the node has a level constraint if (twigNode.getTag(LevelPropertyParser.LEVEL_PROPERTY) != null) { query.setLevelConstraint((Integer) twigNode.getTag(LevelPropertyParser.LEVEL_PROPERTY)); }//ww w .j a v a2s.c o m // check if the node has a node range constraint if (twigNode.getTag(RangePropertyParser.RANGE_PROPERTY) != null) { final int[] range = (int[]) twigNode.getTag(RangePropertyParser.RANGE_PROPERTY); query.setNodeConstraint(range[0], range[1]); } // process root query this.processRoot(twigNode, query); // process child and descendant queries try { this.processChildren(children, query); } catch (final TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), twigNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } return query; }
From source file:org.sindice.siren.qparser.json.builders.BooleanQueryNodeBuilder.java
License:Apache License
public BooleanQuery build(final QueryNode queryNode) throws QueryNodeException { final BooleanQueryNode booleanNode = (BooleanQueryNode) queryNode; final BooleanQuery bQuery = new BooleanQuery(true); final List<QueryNode> children = booleanNode.getChildren(); for (final QueryNode child : children) { final Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); // wrap the query into a LuceneProxyNodeQuery final Query query = new LuceneProxyNodeQuery((NodeQuery) obj); try {/*from w ww .j a v a2s. co m*/ bQuery.add(query, getModifierValue(child)); } catch (final TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), queryNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } } return bQuery; }
From source file:org.sindice.siren.qparser.json.builders.TwigQueryNodeBuilder.java
License:Apache License
@Override public TwigQuery build(final QueryNode queryNode) throws QueryNodeException { final TwigQueryNode twigNode = (TwigQueryNode) queryNode; final List<QueryNode> children = twigNode.getChildren(); final TwigQuery query = new TwigQuery(); // check if the node has a level constraint if (twigNode.getTag(LevelPropertyParser.LEVEL_PROPERTY) != null) { query.setLevelConstraint((Integer) twigNode.getTag(LevelPropertyParser.LEVEL_PROPERTY)); }/*from ww w .j av a 2 s . c o m*/ // check if the node has a node range constraint if (twigNode.getTag(RangePropertyParser.RANGE_PROPERTY) != null) { final int[] range = (int[]) twigNode.getTag(RangePropertyParser.RANGE_PROPERTY); query.setNodeConstraint(range[0], range[1]); } // process root query if (twigNode.hasRoot()) { final String rootExpr = twigNode.getRoot().toString(); final String field = twigNode.getField().toString(); query.addRoot((NodeQuery) keywordParser.parse(rootExpr, field)); } // process child and descendant queries try { processChildren(children, query); } catch (final TooManyClauses ex) { throw new QueryNodeException(new MessageImpl(QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery.getMaxClauseCount(), twigNode.toQueryString(new EscapeQuerySyntaxImpl())), ex); } return query; }