After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737541 - freebase: search query buglets
freebase: search query buglets
Status: RESOLVED FIXED
Product: libgdata
Classification: Platform
Component: General
git master
Other Mac OS
: Normal normal
: ---
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2014-09-28 17:47 UTC by Carlos Garnacho
Modified: 2014-12-23 10:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
freebase: Fix typo in search query (1.27 KB, patch)
2014-09-28 17:47 UTC, Carlos Garnacho
committed Details | Review
freebase: Translate meters to feet on geolocated queries (1.83 KB, patch)
2014-09-28 17:48 UTC, Carlos Garnacho
needs-work Details | Review
freebase: Fix locale-dependent issues in geolocated queries (1.55 KB, patch)
2014-09-28 17:48 UTC, Carlos Garnacho
committed Details | Review
tests: Add tests for Freebase search API (11.94 KB, patch)
2014-10-05 16:55 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2014-09-28 17:47:13 UTC
Upon more elaborate usage, I found a few tiny bugs in the freebase search api, plus one that spotted on the service since support was added... I'm attaching patches for these.
Comment 1 Carlos Garnacho 2014-09-28 17:47:58 UTC
Created attachment 287301 [details] [review]
freebase: Fix typo in search query

The string array matches the GDataFreebaseSearchFilterType, using the
FilterNodeType was unintended, and TYPE_CONTAINER happened to match
GDATA_FREEBASE_SEARCH_FILTER_ALL.
Comment 2 Carlos Garnacho 2014-09-28 17:48:02 UTC
Created attachment 287302 [details] [review]
freebase: Translate meters to feet on geolocated queries

Since support was added, the service started giving "backend errors" when
performing "within radius" queries in meters, although queries in feet do
work. Start using this, and translate the value given in meters.
Comment 3 Carlos Garnacho 2014-09-28 17:48:07 UTC
Created attachment 287303 [details] [review]
freebase: Fix locale-dependent issues in geolocated queries

Latitude/longitude are really expected with a '.' decimal point by the
service, breaking on locales that would use anything different. Use
g_ascii_formatd which always uses the '.' decimal point.
Comment 4 Philip Withnall 2014-09-30 08:04:29 UTC
Review of attachment 287301 [details] [review]:

Looks good, but unit tests are needed! Something like: https://git.gnome.org/browse/libgdata/tree/gdata/tests/tasks.c#n81
Comment 5 Philip Withnall 2014-09-30 08:06:27 UTC
Review of attachment 287302 [details] [review]:

::: gdata/services/freebase/gdata-freebase-search-query.c
@@ +47,3 @@
 
+#define FEET_PER_METER 3.2808
+#define METERS_TO_FEET(m) ((guint64) ((gdouble) (m) * FEET_PER_METER))

This will truncate rather than rounding. We should probably use round() here.

@@ +252,3 @@
+		g_string_append_printf (str, "(within radius:%" G_GUINT64_FORMAT "ft lon:%.4f lat:%.4f)",
+					METERS_TO_FEET(node->location.radius),
+					node->location.lon, node->location.lat);

Have you filed a bug with Google about this? Not supporting (or rather, breaking support for) metres is ridiculous, and is hopefully a simple and fixable bug at their end.

Please file a bug with them and link to it in a FIXME comment here. Then we can revert to using metres when they fix their servers.
Comment 6 Philip Withnall 2014-09-30 08:08:11 UTC
Review of attachment 287303 [details] [review]:

Whoops, good catch.
Comment 7 Carlos Garnacho 2014-09-30 09:38:31 UTC
(In reply to comment #5)
> Review of attachment 287302 [details] [review]:
> @@ +252,3 @@
> +        g_string_append_printf (str, "(within radius:%" G_GUINT64_FORMAT "ft
> lon:%.4f lat:%.4f)",
> +                    METERS_TO_FEET(node->location.radius),
> +                    node->location.lon, node->location.lat);
> 
> Have you filed a bug with Google about this? Not supporting (or rather,
> breaking support for) metres is ridiculous, and is hopefully a simple and
> fixable bug at their end.

Apparently Freebase is keeping bugs in their own Jira... that'd be https://bugs.freebase.com/browse/API-110

> 
> Please file a bug with them and link to it in a FIXME comment here. Then we can
> revert to using metres when they fix their servers.

Will get to this and the unit tests later today :)
Comment 8 Carlos Garnacho 2014-10-05 16:55:59 UTC
Created attachment 287769 [details] [review]
tests: Add tests for Freebase search API
Comment 9 Carlos Garnacho 2014-10-05 17:00:02 UTC
(In reply to comment #7)
> 
> Apparently Freebase is keeping bugs in their own Jira... that'd be
> https://bugs.freebase.com/browse/API-110

They were extremely responsive and fixed this bug, I'm marking that patch as obsolete.

FWIW, the patch to add tests for the search API applies on top of the tests' one in bug #737539
Comment 10 Philip Withnall 2014-10-16 08:27:51 UTC
Review of attachment 287769 [details] [review]:

Looks good to me apart from that one niggle.

::: gdata/tests/freebase.c
@@ +72,3 @@
+	result = gdata_freebase_service_search (GDATA_FREEBASE_SERVICE (service), query, NULL, &error);
+	g_assert_no_error (error);
+	g_assert_nonnull (result);

Same comment as in the other bugs: I don’t really want to bump libgdata’s GLib dependency for this macro. Can you use g_assert() instead please?
Comment 11 Philip Withnall 2014-10-16 08:29:00 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > 
> > Apparently Freebase is keeping bugs in their own Jira... that'd be
> > https://bugs.freebase.com/browse/API-110
> 
> They were extremely responsive and fixed this bug, I'm marking that patch as
> obsolete.

Also: go them, woo! \o/
Comment 12 Carlos Garnacho 2014-12-23 10:22:54 UTC
The tests were fixed and everything pushed :)

Attachment 287301 [details] pushed as 43dd188 - freebase: Fix typo in search query
Attachment 287303 [details] pushed as 021370e - freebase: Fix locale-dependent issues in geolocated queries
Attachment 287769 [details] pushed as 8400bc6 - tests: Add tests for Freebase search API