Examples of RangeQueryNode


Examples of dovetaildb.querynode.RangeQueryNode

        if (rec.token >= prefix.get(i)) {
          if (rec.token > prefix.get(i)) return null;
          if (rec.tokenTable==null) {
            Bytes pre = new SlicedBytes(prefix, 0, i+1);
            pre = new ArrayBytes(pre.getBytes()); // optimize
            RangeQueryNode ret = new BlueSteelPostingListQuery(pre, rec.segmentPush);
            return FilteredRangeQueryNode.make(ret, prefix, term1, term2, isExclusive1, isExclusive2);
          }
          table = rec.tokenTable;
          bos.write(rec.token);
          break;
        }
      }
    }
    if (bos.size() > 0) {
      prefix = new CompoundBytes(prefix, new ArrayBytes(bos.toByteArray())).flatten();
    }
   
    if (table == null) return null;
    int top,bottom;
    if (term1 == null) {
      top = 0;
      isExclusive1 = false;
    } else if (term1.getLength() > 0) {
      top = term1.get(0);
    } else {
      top = 0;
    }
    if (term2 == null) {
      bottom = 255;
      isExclusive2 = false;
    } else if (term2.getLength() > 0) {
      bottom = term2.get(0);
    } else { //specified, but is empty (must be a very narrow range!)
      bottom = 0;
    }
    Iterator<TokenRec> itr = table.getTokenRecs().iterator();
    TokenRec rec;
    do {
      if (! itr.hasNext()) return null;
      rec = itr.next();
    } while((0xFF & rec.token) < top);
    if (top==bottom) {
      RangeQueryNode q = new BlueSteelPostingListQuery(prefix, rec.token, rec.segmentPush);
      return FilteredRangeQueryNode.make(q, null, term1, term2, isExclusive1, isExclusive2);
    }
    List<RangeQueryNode> queries = new ArrayList<RangeQueryNode>();
    if (rec.token == top) {
      RangeQueryNode q = new BlueSteelPostingListQuery(prefix, rec.token, rec.segmentPush);
      q = FilteredRangeQueryNode.make(q, null, term1, null, isExclusive1, false);
      queries.add(q);
    }
    while(rec.token < bottom) {
      queries.add(new BlueSteelPostingListQuery(prefix, rec.token, rec.segmentPush));
      if (! itr.hasNext()) break;
      rec = itr.next();
    }
    if (rec.token == bottom) {
      RangeQueryNode q = new BlueSteelPostingListQuery(prefix, rec.token, rec.segmentPush);
      q = FilteredRangeQueryNode.make(q, null, null, term2, false, isExclusive2);
      queries.add(q);
    }
    return new OrderedOrQueryNode(queries, prefix, term1, term2, isExclusive1, isExclusive2);
  }
View Full Code Here

Examples of dovetaildb.querynode.RangeQueryNode

  @Override
  public RangeQueryNode getRange(final Bytes prefix, final Bytes term1, final Bytes term2,
      final boolean isExclusive1, final boolean isExclusive2, long revNum) {
    final ArrayList<EditRec> all = revs.get((int)revNum);
    if (all.size() == 0) return null;
    RangeQueryNode world = new RangeQueryNode() {
      int i=0;
      public void adjustPrefix(Bytes prefix) { throw new RuntimeException(); }
      public void adjustSuffixMax(Bytes newMax, boolean isExclusive) { throw new RuntimeException(); }
      public void adjustSuffixMin(Bytes newMin, boolean isExclusive) { throw new RuntimeException(); }
      public Bytes getPrefix() { return prefix; }
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

      }

      lower.setText(part1);
      upper.setText(part2);

      return new RangeQueryNode(lower, upper, collator);

    }

    return node;
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

      }

      lower.setText(part1);
      upper.setText(part2);

      return new RangeQueryNode(lower, upper, collator);

    }

    return node;
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

  public RangeQueryNodeBuilder() {
    // empty constructor
  }

  public TermRangeQuery build(QueryNode queryNode) throws QueryNodeException {
    RangeQueryNode rangeNode = (RangeQueryNode) queryNode;
    ParametricQueryNode upper = rangeNode.getUpperBound();
    ParametricQueryNode lower = rangeNode.getLowerBound();

    boolean lowerInclusive = false;
    boolean upperInclusive = false;

    if (upper.getOperator() == CompareOperator.LE) {
      upperInclusive = true;
    }

    if (lower.getOperator() == CompareOperator.GE) {
      lowerInclusive = true;
    }

    String field = rangeNode.getField().toString();

    TermRangeQuery rangeQuery = new TermRangeQuery(field, lower
        .getTextAsString(), upper.getTextAsString(), lowerInclusive,
        upperInclusive, rangeNode.getCollator());
   
    MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod) queryNode
        .getTag(MultiTermRewriteMethodProcessor.TAG_ID);
   
    if (method != null) {
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

      }

      lower.setText(part1);
      upper.setText(part2);

      return new RangeQueryNode(lower, upper, collator);

    }

    return node;
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

  public RangeQueryNodeBuilder() {
    // empty constructor
  }

  public TermRangeQuery build(QueryNode queryNode) throws QueryNodeException {
    RangeQueryNode rangeNode = (RangeQueryNode) queryNode;
    ParametricQueryNode upper = rangeNode.getUpperBound();
    ParametricQueryNode lower = rangeNode.getLowerBound();

    boolean lowerInclusive = false;
    boolean upperInclusive = false;

    if (upper.getOperator() == CompareOperator.LE) {
      upperInclusive = true;
    }

    if (lower.getOperator() == CompareOperator.GE) {
      lowerInclusive = true;
    }

    String field = rangeNode.getField().toString();

    TermRangeQuery rangeQuery = new TermRangeQuery(field, lower
        .getTextAsString(), upper.getTextAsString(), lowerInclusive,
        upperInclusive, rangeNode.getCollator());
   
    MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodAttribute.TAG_ID);
    if (method != null) {
      rangeQuery.setRewriteMethod(method);
    }
View Full Code Here

Examples of org.apache.lucene.queryParser.standard.nodes.RangeQueryNode

      }

      lower.setText(part1);
      upper.setText(part2);

      return new RangeQueryNode(lower, upper, collator);

    }

    return node;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.