/** * Adds a descendant clause with a * {@link NodeBooleanClause.Occur#MUST} operator. * <p> * Use this method for descendant clauses that must appear in the matching * twigs. * * @see NodeBooleanClause.Occur#MUST * @see com.sindicetech.siren.search.node.TwigQuery#addDescendant(int, NodeQuery, NodeBooleanClause.Occur) */ public TwigQuery with(final AbstractNodeQuery descendant, final int level) { clauses.add(new DescendantQueryClause(descendant, Occur.MUST, level)); return this; }
final int level = ((DescendantQueryClause) clause).getLevel(); query.addDescendant(level, (NodeQuery) clause.getQuery().toQuery(false), clause.getNodeBooleanOccur());
e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel()); e.putAll(clause.getQuery().toJson());
/** * Adds a descendant clause with a * {@link NodeBooleanClause.Occur#MUST_NOT} operator. * <p> * Use this method for descendant clauses that must not appear in the matching * twigs. * * @see NodeBooleanClause.Occur#MUST_NOT * @see com.sindicetech.siren.search.node.TwigQuery#addDescendant(int, NodeQuery, NodeBooleanClause.Occur) */ public TwigQuery without(final AbstractNodeQuery descendant, final int level) { clauses.add(new DescendantQueryClause(descendant, Occur.MUST_NOT, level)); return this; }
/** * Adds a descendant clause with a * {@link NodeBooleanClause.Occur#SHOULD} operator. * <p> * Use this method for descendant clauses that should appear in the matching * twigs. * * @see NodeBooleanClause.Occur#SHOULD * @see com.sindicetech.siren.search.node.TwigQuery#addDescendant(int, NodeQuery, NodeBooleanClause.Occur) */ public TwigQuery optional(final AbstractNodeQuery descendant, final int level) { clauses.add(new DescendantQueryClause(descendant, Occur.SHOULD, level)); return this; }