Subscribe rss
Blog categories
All | Backendless features
Feature 51: Partial match geopoint search
February 28, 2015 by markpiller

Backendless supports multiple ways to perform a geopoint search. You can search in radius, a rectangular area and there is a search with an SQL query. Additionally, there is a way to search on partial metadata match. This type of search can be combined with all other aforementioned search types. A partial match search will return geopoints whose metadata matches the values specified in the query for the specified (or greater) number of percent. Consider the sample geodata from the article on how to import geodata from a CSV file. The imported data is rendered as shown below in Backendless console:

Suppose each geopoint represents a profile of a person with interests and food preferences. Each geopoint contains the following metadata properties: burgers, hiking, chinese, gender and city, with the first three containing the values of yes or no. Suppose a search needs to find all the geopoints that have a 30% match for the following key/value pairs: burgers=yes, hiking=yes and/or chinese=yes. In others words it does not matter which properties match as long as one third of them have the specified values (one third is roughly 30%). Consider the following code:

Asynchronous sample (Android and Plain Java):

Synchronous sample (Plain Java only):

The program output is:

As you can see the search accomplished exactly what I wanted – a partial match at or greater than the percentage threshold. Notice that the search results are returned through a collection of the SearchMatchesResult objects. Each object contains a geopoint and the percentage of matches for the geopoint’s metadata against the requested key/value properties.


Share this post
Tweet about this on TwitterShare on FacebookGoogle+