protected void processChildren(QueryNode queryTree) throws QueryNodeException { List<QueryNode> children = queryTree.getChildren(); if (children != null && children.size() > 0) { for (QueryNode child : children) { child = processIteration(child); } } }
protected void processChildren(QueryNode queryTree) throws QueryNodeException { List<QueryNode> children = queryTree.getChildren(); if (children != null && children.size() > 0) { for (QueryNode child : children) { child = processIteration(child); } } }
@Override protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException { if (node instanceof BooleanQueryNode) { List<QueryNode> children = node.getChildren(); if (children != null && children.size() == 1) { QueryNode child = children.get(0); if (child instanceof ModifierQueryNode) { ModifierQueryNode modNode = (ModifierQueryNode) child; if (modNode instanceof BooleanModifierNode || modNode.getModifier() == Modifier.MOD_NONE) { return child; } } else { return child; } } } return node; }
@Override protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException { if (node instanceof BooleanQueryNode || node instanceof BoostQueryNode || node instanceof TokenizedPhraseQueryNode || node instanceof ModifierQueryNode) { List<QueryNode> children = node.getChildren(); if (children != null && children.size() > 0) { for (QueryNode child : children) { if (!(child instanceof DeletedQueryNode)) { return node; } } } return new MatchNoDocsQueryNode(); } return node; }
@Override public QueryNode process(QueryNode queryTree) throws QueryNodeException { queryTree = super.process(queryTree); if (!queryTree.isLeaf()) { List<QueryNode> children = queryTree.getChildren(); if (children == null || children.size() == 0) { return new MatchNoDocsQueryNode(); } } return queryTree; }
@Override public QueryNode process(QueryNode queryTree) throws QueryNodeException { queryTree = super.process(queryTree); if (!queryTree.isLeaf()) { List<QueryNode> children = queryTree.getChildren(); if (children == null || children.size() == 0) { return new MatchNoDocsQueryNode(); } } return queryTree; }
private void readTree(final QueryNode node) throws QueryNodeException { if (node instanceof BooleanQueryNode) { final List<QueryNode> children = node.getChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size() - 1; i++) { this.readTree(children.get(i)); } this.processNode(node); this.readTree(children.get(children.size() - 1)); } else { this.processNode(node); } } else { this.processNode(node); } }
private void readTree(QueryNode node) { if (node instanceof BooleanQueryNode) { List<QueryNode> children = node.getChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size() - 1; i++) { readTree(children.get(i)); } processNode(node); readTree(children.get(children.size() - 1)); } else { processNode(node); } } else { processNode(node); } }
private void readTree(final QueryNode node) throws QueryNodeException { if (node instanceof BooleanQueryNode) { final List<QueryNode> children = node.getChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size() - 1; i++) { this.readTree(children.get(i)); } this.processNode(node); this.readTree(children.get(children.size() - 1)); } else { this.processNode(node); } } else { this.processNode(node); } }
private void readTree(QueryNode node) { if (node instanceof BooleanQueryNode) { List<QueryNode> children = node.getChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size() - 1; i++) { readTree(children.get(i)); } processNode(node); readTree(children.get(children.size() - 1)); } else { processNode(node); } } else { processNode(node); } }
private void doSetField(final List<QueryNode> children, final CharSequence fieldName) { if (children != null) { for (final QueryNode child : children) { this.doSetField(child.getChildren(), fieldName); if (child instanceof FieldableNode) { ((FieldableNode) child).setField(fieldName); } else if (child instanceof TwigQueryNode) { ((TwigQueryNode) child).setField(fieldName); } } } }
public Query build(final QueryNode queryNode) throws QueryNodeException { final DatatypeQueryNode dtNode = (DatatypeQueryNode) queryNode; final QueryNode child = dtNode.getChild(); assert queryNode.getChildren().size() == 1; final Query query = (Query) child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); this.setDatatype(child, dtNode.getDatatype()); return query; }
private void doSetField(final List<QueryNode> children, final CharSequence fieldName) { if (children != null) { for (final QueryNode child : children) { this.doSetField(child.getChildren(), fieldName); if (child instanceof FieldableNode) { ((FieldableNode) child).setField(fieldName); } else if (child instanceof TwigQueryNode) { ((TwigQueryNode) child).setField(fieldName); } } } }
protected void fillChildrenBufferAndApplyModifiery(QueryNode parent) { for (QueryNode node : parent.getChildren()) { if (node.containsTag(TAG_REMOVE)) { fillChildrenBufferAndApplyModifiery(node); } else if (node.containsTag(TAG_MODIFIER)) { childrenBuffer.add(applyModifier(node, (Modifier) node.getTag(TAG_MODIFIER))); } else { childrenBuffer.add(node); } } }
protected void fillChildrenBufferAndApplyModifiery(QueryNode parent) { for (QueryNode node : parent.getChildren()) { if (node.containsTag(TAG_REMOVE)) { fillChildrenBufferAndApplyModifiery(node); } else if (node.containsTag(TAG_MODIFIER)) { childrenBuffer.add(applyModifier(node, (Modifier) node.getTag(TAG_MODIFIER))); } else { childrenBuffer.add(node); } } }
private void process(QueryNode node) throws QueryNodeException { if (node != null) { QueryBuilder builder = getBuilder(node); if (!(builder instanceof QueryTreeBuilder)) { List<QueryNode> children = node.getChildren(); if (children != null) { for (QueryNode child : children) { process(child); } } } processNode(node, builder); } }
private CharSequence doGetField(final List<QueryNode> children) { if (children != null) { for (final QueryNode child : children) { if (child instanceof FieldableNode) { return ((FieldableNode) child).getField(); } else if (child instanceof TwigQueryNode) { return ((TwigQueryNode) child).getField(); } final CharSequence field = this.doGetField(child.getChildren()); if (field != null) { return field; } } } return null; }
private void process(QueryNode node) throws QueryNodeException { if (node != null) { QueryBuilder builder = getBuilder(node); if (!(builder instanceof QueryTreeBuilder)) { List<QueryNode> children = node.getChildren(); if (children != null) { for (QueryNode child : children) { process(child); } } } processNode(node, builder); } }
private CharSequence doGetField(final List<QueryNode> children) { if (children != null) { for (final QueryNode child : children) { if (child instanceof FieldableNode) { return ((FieldableNode) child).getField(); } else if (child instanceof TwigQueryNode) { return ((TwigQueryNode) child).getField(); } final CharSequence field = this.doGetField(child.getChildren()); if (field != null) { return field; } } } return null; }
/** * Sets the given datatype on each descendant of the {@link DatatypeQueryNode} */ private void setDatatype(final QueryNode node, final String datatype) { final Query query = (Query) node.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (query instanceof NodePrimitiveQuery) { ((NodePrimitiveQuery) query).setDatatype(datatype); } if (node.isLeaf()) { return; } for (final QueryNode child : node.getChildren()) { this.setDatatype(child, datatype); } }