Esempio n. 1
0
  /**
   * Clears {@link #next} and tries to fetch the next Node instance. When this method returns {@link
   * #next} refers to the next available node instance in this iterator. If {@link #next} is null
   * when this method returns, then there are no more valid element in this iterator.
   */
  private void fetchNext() {
    // reset
    next = null;
    nextScore = 0;

    while (next == null && rows.hasNext()) {
      try {
        QueryResultRow row = (QueryResultRow) rows.next();
        nextId = row.getNodeId(null);
        Item tmp = itemMgr.getItem(hierarchyMgr.getNodeEntry(nextId));

        if (tmp.isNode()) {
          next = (Node) tmp;
          nextScore = row.getScore(null);
        } else {
          log.warn("Item with Id is not a Node: " + nextId);
          // try next
          invalid++;
          pos++;
        }
      } catch (Exception e) {
        log.warn("Exception retrieving Node with Id: " + nextId);
        // try next
        invalid++;
        pos++;
      }
    }
    pos++;
  }