In my last two posts I covered the basics of ways you can search, and what data you can search using our new Search Service. For this post I’m going to cover some of the cool things the service has to offer that didn’t fit into my previous posts. If you haven’t already, you might want to check out Search Service Part 1 – How to Search and Search Service Part 2 – What can I search? before reading this post.
Other things the Search Service can do
- Search by Travel Time or Distance
- This is not so much a separate search, instead, something you can do on a radius search using the
units=parameter. Instead of choosing miles or kilometres, you can also choose walking or driving minutes, or driving miles or kilometres. If you do this, then the results are filtered to show only those locations you could get to in that amount of time, or by traveling that distance along roads.
- When searching HostedData you can provide a SQL “WHERE” fragment to help further filter your results. Lets say, for example, that you’ve uploaded a table of restaurants that includes a field (“amex”) that specifies whether the restaurant accepts American Express. When doing a search, you could use
ExtraCriteria:"amex=1"to only return restaurants that take American Express.
- Specifying Field Names
- With HostedData, you can ask to only have certain fields returned, which is useful for keeping the size of the response down if you don’t need all the fields. All you have to do is provide an array of the field names you do want. If you don’t provide the array, we’ll return all fields for each record by default.
- Results Paging
- You don’t have to receive all your results at once. If you tell us a
pageSizeon your request, we’ll break the results down into pages and store them in memory temporarily. The first response will tell you how many pages your results were broken down into, as well as a
pageKey. After that, you can just ask for more results using the
- Mixing Data Sources
- You can search multiple data sources at once and they don’t even have to be the same kind of data source. If you wanted to, you could search 2 HostedData tables, some pieces of RemoteData, and the MapData all at once. Be careful though, the Max Results setting applies across all results, not per data set. If you search 5 data sets at once with a Max Results of 50, you’ll get 50 total results collated from all data sets, not 50 from each.
- Get Record Info
- If you already know the record ID of the data row you need, you can use that ID with the
recordInfofunction to only get the records you want without having to do a spatial search. This is very useful if you want to initially provide some basic info on each search result (a more compact response than returning all fields), and then provide full details if the user drills in for more information.
- SSL Support
- Like all our services, you can access the search result over HTTPS for increased security. There’s really not much to say on this one. Any URLs in the return (like the suggested display icons for the NTPois data set) will also be returned as HTTPS when using SSL.
- KML Support
- The Search Service supports
A map of Philadelphia, using a RemoteCollection to load the parks as KML from the search service, and then display on the map
Well, that’s about all the words I have on the Search Service. Thanks for bearing with me across three rambling posts. The amount of functionality and power in the service has definitely made it interesting to blog about.
More details are, as always, available on our Developer Network Beta Release page.
If you haven’t tried any of our new services and SDKs in Beta yet, you can sign up for an appKey here.
Stay tuned…more to follow soon.