Geographic searches are specified using a $DISTANCE function. As long as there is a multi-column Omnidex index containing the latitude and longitude, the $distance function will be automatically optimized.
The following are examples of several types of geographic searches that can be optimized using the $distance function.
SELECT $distance(40.0, -105.0, 41.0, -106.0) distance FROM $omnidex;
SELECT zip, $distance(40.0, -105.0, latitude, longitude) distance, latitude, longitude, FROM zipcodes WHERE $distance(40.0, -105.0, latitude, longitude) < 10;
SELECT state, zip, latitude, longitude FROM zipcodes WHERE $distance(latitude, longitude, (SELECT latitude, longitude FROM zipcodes WHERE state = 'CO')) < 5;