GNOME Bugzilla – Bug 758524
Cannot search documents by title
Last modified: 2015-12-08 18:37:19 UTC
When searching a document by title, libgdata encodes the title as a URL parameter, instead of composing it into the "q" query string. Google does not recognize this URL parameter and ignores it, causing all searches to return the unfiltered set of documents. For example, when searching for "family", the following URL is generated: libgdata-DEBUG: > GET /drive/v2/files?q=trashed%3Dfalse%20and%20mimeType%21%3D%27application%2Fvnd.google-apps.folder%27&title=family HTTP/1.1 instead of the correct one: /drive/v2/files?q=trashed%3Dfalse%20and%20mimeType%21%3D%27application%2Fvnd.google-apps.folder%27%20and%20title%3D%27family%27 The exact-title property should transform the query string to use "contains", instead of being also appended as an unrecognized URL parameter.
Created attachment 316099 [details] [review] Update to v2 API This patch works for me.
Created attachment 316100 [details] [review] Update to v2 API (fix commit message and author's e-mail)
Review of attachment 316100 [details] [review]: This looks good; just a few minor fixes needed. Thanks! ::: gdata/services/documents/gdata-documents-query.c @@ +364,1 @@ if (priv->title != NULL) { Please add a comment pointing to the reference for this syntax: https://developers.google.com/drive/web/search-parameters @@ +367,3 @@ + + title_query = g_string_new ("title"); + if (priv->exact_title == TRUE) { No need for the ‘== TRUE’ (I know other code in libgdata does this; it’s an obsolete coding style we’re moving away from). @@ +375,3 @@ + + for (ptr = priv->title; ptr != NULL; ptr = ptr_end) + { The ‘{’ should be on the previous line.
Created attachment 316247 [details] [review] Update to v2 API Thanks Philip for the review. I made a new version with the patch containing the desired changes. However, I didn't add the comment about the Google search API URL, because that link is already there, at the beginning of that method.
Review of attachment 316247 [details] [review]: ++
Hi Philip, I don't have commit access to the repos, so someone else should push this commit for me.
Pushed to master.