docs: function parse_selector(selector, contextmodels){
  
    var main_query = [];
  
    if(!selector){
      return [];
    }
  
  
    if(selector.diggerid){
      main_query.push({
        field:'_digger.diggerid',
        operator:'=',
        value:selector.diggerid
      })
    }
    /*
    
      we are finding the context itself not beneath it
      
    */
    else if(selector.tag==='self'){
  
      var ors = _.map(contextmodels, function(model){
        return {
          field:'_digger.diggerid',
          operator:'=',
          value:model.diggerid
        }
      })
  
      if(ors.length<=0){
  
      }
      else if(ors.length==1){
        main_query.push(ors[0]);
      }
      else{
        main_query.push({
          '$or':ors
        })
      }
      
  
    }
    else{
      // this is for a thing like:
      //    > folder.red product
      // i.e. folders on the root
      if(selector.splitter=='>' && (!contextmodels || contextmodels.length<=0)){
        main_query.push({
          field:'_digger.diggerparentid',
          operator:'=',
          value:null
        })
      }
  
      if(selector.tag==='*'){
        main_query.push({
          field:'_digger',
          operator:'exists'
        })
      }
      else {
        if(selector.tag){
          main_query.push({
            field:'_digger.tag',
            operator:'=',
            value:selector.tag
          })
        }
  
        if(selector.id){
          main_query.push({
            field:'_digger.id',
            operator:'=',
            value:selector.id
          })
        }
  
        if(_.keys(selector.class).length>0){
  
          _.each(_.keys(selector.class), function(classname){
  
            main_query.push({
              field:'_digger.class',
              operator:'=',
              value:classname
            })
            
          })
        }
  
        if(selector.attr){
          _.each(selector.attr, function(attr){
            
            var operator = attr.operator;
            var value = attr.value;
  
            if(_.isEmpty(attr.operator)){
              attr.operator = 'exists';
            }
            
            main_query.push(attr);
          })
        }
      }
    }
  
    return main_query;
  }