Hi,
try to create this function with the parameters lat,lon,maxDistance,sku

var g=orient.getGraph();
var b=g.command("sql","select from Stores where [lat,lon,$spatial] NEAR 
["+lat+","+lon+",{'maxDistance':"+maxDistance+"}]");
var vector = [] ;
for(i=0;i<b.length;i++){
  var id=b[i].getId().toString();
  var c=g.command("sql","select expand(out('hasInventory')) from "+id);
    for(j=0;j<c.length;j++){
      if(c[j].getProperty("sku")==sku){
          var d=g.command("sql","select expand(outE('hasInventory')) from 
"+id);
          for(z=0;z<d.length;z++){
              if(d[i].getProperty("quantity")>0){
                vector.push(b[i]);
                break;
              }
            }
          break;
      }
    }
}
return vector;

and from broswe try this
SELECT expand(myFunction(19.195524,72.834810,2000,"8907103076739")) from 
 (SELECT myFunction(19.195524,72.834810,2000,"8907103076739"))

let me know if the query goes faster.

Best regards,
Alessandro

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to