Example #1
0
 @Override
 public FTExpr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   final FTWords ftw =
       new FTWords(
           info,
           query.copy(qc, scp, vs),
           mode,
           occ == null ? null : Arr.copyAll(qc, scp, vs, occ));
   if (ftt != null) ftw.ftt = ftt.copy(ftw);
   ftw.tokens = tokens;
   ftw.data = data;
   ftw.first = first;
   ftw.pos = pos;
   ftw.fast = fast;
   return ftw;
 }
Example #2
0
  @Override
  public final Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException {
    // invalidate current context value (will be overwritten by filter)
    final Value cv = ctx.value;
    try {
      // return empty root
      if (root.isEmpty()) return optPre(null, ctx);
      // convert filters without numeric predicates to axis paths
      if (root instanceof AxisPath && !super.has(Flag.FCS))
        return ((AxisPath) root.copy(ctx, scp)).addPreds(ctx, scp, preds);

      // no predicates.. return root; otherwise, do some advanced compilations
      return preds.length == 0 ? root : opt(ctx);
    } finally {
      ctx.value = cv;
    }
  }
Example #3
0
 @Override
 public Expr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   return new TypeSwitch(info, ts.copy(qc, scp, vs), Arr.copyAll(qc, scp, vs, cases));
 }