When used with a standard attribute of type geocode, the EQL DISTANCE function indicates a filter based on the distance of that geocode attribute from a given reference point.
DISTANCE(geoAttribute, TO_GEOCODE(latitude,longtitude))where geoAttribute is a standard attribute of type geocode.
Note that distance limits in geocode filters are always expressed in kilometers. The records are filtered by the distance from the geocode reference point to the latitude/longitude pair.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <Request xmlns="http://www.endeca.com/MDEX/conversation/2/0"> <Language>en</Language> <State> <DataSourceFilterString> COUNTRY_NAME = 'United States of America' </DataSourceFilterString> <SelectionFilterString> DISTANCE(Location, TO_GEOCODE(40.758224, -73.917404)) BETWEEN 1 AND 500 </SelectionFilterString> </State> <ContentElementConfig xsi:type="RecordListConfig" HandlerFunction="RecordListHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/handlers/2010" Id="RecordList" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> </ContentElementConfig> </Request> </soapenv:Body> </soapenv:Envelope>
The query returns only records whose location (in the Location property) is between 1 and 500 kilometers from the reference point.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <Request xmlns="http://www.endeca.com/MDEX/conversation/2/0"> <State> <DataSourceFilterString> COUNTRY_NAME = 'United States of America' </DataSourceFilterString> <SelectionFilterString> DISTANCE(Location, TO_GEOCODE(40.758224, -73.917404)) > 200 </SelectionFilterString> </State> <ContentElementConfig xsi:type="RecordListConfig" HandlerFunction="RecordListHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/handlers/2010" Id="RecordList" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> </ContentElementConfig> </Request> </soapenv:Body> </soapenv:Envelope>
The query returns only records whose location (in the Location property) is equal to or greater than 200 kilometers from the reference point.
An example of a less-than query would be the same except for the use of the < (less-than) operator.