Forum Home

Search

Search is the process of converting code to address using AGSearch class. There is a sample process.

If you search by a code like "cape town", sample code is:

Search Sample

With cache:
var oCache = new AGSearchCache();
var oSearchCache = new AGSearch(oCache);
Without cache:
var oSearchCache = new AGSearch();
Search by code
oSearchCache.search("cape town",callbackSearchedResult); //call callbackSearchedResult(oResponse)

Above request responses in callbackSearchedResult(oResponse) and the format is

Response format

"
{
   'SearchResults':
      [ 
         { 
             ResultItem:
                  {
                     'Description':'WATERFORD SIMON S TOWN SIMON S TOWN WESTERN CAPE',
                     'Latitude':'-34.193992',
                     'Longitude':'18.433811'
                  }
         },
         {
             ResultItem:
                  {
                     'Description':'ADDERLEY STREET CAPE TOWN CITY CENTRE CAPE TOWN WESTERN CAPE',
			            'Latitude':'-33.924681',
			            'Longitude':'18.420373'
		  },
		  ......
		  ......
		  .
		  .
         }
       ]
}
"


Cache

If same code is requested API response from cache without requesting server, API user can use of his or her own cache which can be used for any other purpose.

Classes

AGSearch AGSearchCache