Support Topics Documentation Slack YouTube Blog

Query for GeoPoints that miss particular metadata

Hello again,

I’m in the process of migrating from Geo Service to Spatial Data and want to create a timer that syncs between both services for the migration period.
My idea is to have a metadata flag that marks already migrated GeoPoints and take only those that miss the flag.

I tried:
geoQuery.setWhereClause("migrated IS NULL");
and:
HashMap metaSearch = new HashMap();
metaSearch.put(“migrated”, null);
geoQuery.setMetadata(metaSearch);

However, both approaches return 0 GeoPoints even though none of the GeoPoints have it. What is the correct approach to query for the GeoPoints that miss this metadata? Or maybe you can suggest an alternative approach?

Thanks!

P.S. I can take the whole dataset and enumerate it checking each GeoPoint individually but that not efficient at all!

Hi @milen-marinov!

It seems like bug in search logic - such whereClause will not work. I have tried it by myself and got same wrong behavior.
Could you mark all your old points with migrated: false before migration? Then you will be able to search not migrated properties wich next whereClause - “migrated = ‘false’”.

Regards, Andriy

Hi,

Thanks for the quick reply!
That’s not really an option as users with the old app versions will continue submitting new GeoPoints (which will miss the migrated flag) and I want those to get migrated at next timer run.

Best,
Milen

@milen-marinov

You can try to solve your problem with event handlers. You can add event handler on “beforeAddPoint” event and add required metedata to point before save. In this case you will be able to migrate your geopints using timer.

Regards, Andriy

Yes, that is one option. I can actually directly migrate it in ‘beforeAddPoint’ if there is no option at all to search for missing metadata.