Package dovetaildb.querynode

Examples of dovetaildb.querynode.QueryNode.doc()


public class QueryNodeDbResultTest extends TestCase {
 
  public void testBasic() {
    QueryNode node = QueryNodeTest.testingQueryNode();
    QueryNodeDbResult result = new QueryNodeDbResult(node);
    result.initialize(node.doc());
    assertTrue(result.isObject());
    assertEquals("002",result.derefByKey("id").simplify());
    assertEquals("32",result.derefByKey("age").simplify());
    assertEquals("phil",result.derefByKey("name").simplify());
    assertEquals(null,result.derefByKey("xxx").simplify());
View Full Code Here


      outerNode = null;
      return;
    }
    long curDoc = outerNode.doc();
    node.seek(curDoc, ArrayBytes.EMPTY_BYTES);
    if (node.doc() == Long.MAX_VALUE) {
      outerNode = null;
      return;
    }
    rangeSpecializations.add(new RangeSpecialization(range, node));
    ArrayList<QueryNode> nodes = new ArrayList<QueryNode>();
View Full Code Here

          while (tmpIdx > 0 && tmpQueue.get(tmpIdx-1).docId == docId) {
            tmpIdx--;
          }
          n.seek(docId, ArrayBytes.EMPTY_BYTES);
        }
        assertEquals(n.doc(), tmpQueue.get(tmpIdx).docId);
        assertEquals(n.term(), tmpQueue.get(tmpIdx).term);
        if (n.nextTerm() == QueryNode.NextStatus.AT_END) break;
        tmpIdx++;
      }
View Full Code Here

    long revNum = map.getCurrentRevNum();
    QueryNode query = map.getRange(Range.OPEN_RANGE, revNum);
    if (query == null) {
      headTxn = -1;
    } else {
      long docId = query.doc();
      do {
        if (!query.positionSet(docId, ArrayBytes.EMPTY_BYTES)) {
          throw new RuntimeException();
        }
        do {
View Full Code Here

        termForTxnBag(bag, txnId));
    QueryNode query = map.getRange(range, mapRevNum);
    long revNum = 0;
    if (query != null) {
      do {
        long curRev = query.doc();
        if (curRev > revNum) revNum = curRev;
      } while(query.nextTerm() != NextStatus.AT_END);
    }
    return revNum;
    /*
 
View Full Code Here

      clauses.add(q);
    }
    if (clauses.size() > 0) {
      QueryNode idQuery = new OrderedOrQueryNode(clauses, null, null, null, false, false);
      do {
        long docId = idQuery.doc();
        data.skipTo(docId);
        do {
          edits.add(new EditRec(docId, data.term(), true));
        } while(data.nextTerm() == NextStatus.NEXT_TERM);
      } while(idQuery.next());
View Full Code Here

    }
    if (clauses.size() > 0) {
      QueryNode idQuery = new OrderedOrQueryNode(clauses, null, null, null, false, false);
      Map<String, Object> entries = value.getEntries();
      do {
        long docId = idQuery.doc();
        Bytes idTerm = idQuery.term();
        byte[] idBytes = idTerm.subBytes(NUM_ID_BYTES, idTerm.getLength()-NUM_ID_BYTES).getBytes();
        Object val = entries.get(Util.encodeBytes(idBytes));
        DbServiceUtil.sencodeMulti(ArrayBytes.EMPTY_BYTES, val, edits, docId, false);
      } while(idQuery.next());
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.