class TupleToRange implements Function<Tuple2<String,IndexInfo>,Iterator<QueryPlan>> {

    public static Iterator<QueryPlan> createDocumentRanges(JexlNode queryNode, String shard, IndexInfo indexMatches, boolean isTldQuery) {
        List<QueryPlan> ranges = Lists.newArrayListWithCapacity(indexMatches.uids().size());
        
        for (IndexMatch indexMatch : indexMatches.uids()) {
            
            String docId = indexMatch.getUid();
            Range range;
            if (isTldQuery) {
                range = RangeFactory.createTldDocumentSpecificRange(shard, docId);
            } else {
                range = RangeFactory.createDocumentSpecificRange(shard, docId);
            }
            
            if (log.isTraceEnabled())
                log.trace(queryNode + " " + indexMatch.getNode());
            
            // don't really want log statement if uid.getNode is null
            
            // Log info if indexMatch is not null
            if (log.isTraceEnabled() && null != indexMatch.getNode()) {
                
                // query node can be null in this case
                log.trace("Building " + range + " from " + (null == queryNode ? "NoQueryNode" : JexlStringBuildingVisitor.buildQuery(queryNode)) + " actually "
                                + JexlStringBuildingVisitor.buildQuery(indexMatch.getNode()));
            }
            
            ranges.add(new QueryPlan(indexMatch.getNode(), range));
        }
        return ranges.iterator();
    }

    public  TupleToRange(JexlNode currentNode, ShardQueryConfiguration config);

}