SDK search results on disk are sorted randomly

I have the following problem with the Google Drive SDK.

Until a few days ago, query results were sorted by "last modified". Now it seems that I am getting results randomly and I can no longer use this SDK ... I have over 400k docs and I really need to look for them first. When I switched from DocumentList API to Drive SDk, I was sure that the results would be sorted this way (even if we don't have the ability to set a specific type in the SDK).

Is there a way to get sorted results (by the last modified one)? A few weeks ago I reported a bug on the Drive frontend because their UI sorting by last changed didn't work ... maybe the two are related in some way.

Example: For this request (I added a q param - it works fine without it): https://www.googleapis.com/drive/v2/files?maxResults=1000&fields=items (createdDate%2CmodifiedDate%2ClastViewedByMeDate)&access_token=< my_access_token ] & q = fullText% 20contains% 20% 27expert% 27

I get the following results:

{
 "items": [
  {
   "createdDate": "2014-10-24T11:46:59.967Z",
   "modifiedDate": "2015-04-20T15:30:59.804Z",
   "lastViewedByMeDate": "2015-04-20T15:30:59.804Z"
  },
  {
   "createdDate": "2015-04-01T13:27:59.111Z",
   "modifiedDate": "2015-04-01T13:27:58.896Z",
   "lastViewedByMeDate": "2015-04-01T13:52:39.022Z"
  },
  {
   "createdDate": "2015-04-01T11:13:28.795Z",
   "modifiedDate": "2015-04-01T13:27:57.839Z",
   "lastViewedByMeDate": "2015-04-01T13:27:57.839Z"
  },
  {
   "createdDate": "2014-10-22T14:59:40.171Z",
   "modifiedDate": "2015-02-11T21:06:05.092Z",
   "lastViewedByMeDate": "2014-10-22T15:00:14.597Z"
  },
  {
   "createdDate": "2010-10-26T03:53:44.131Z",
   "modifiedDate": "2015-04-21T01:08:35.357Z",
   "lastViewedByMeDate": "2015-04-21T01:08:35.357Z"
  },
  {
   "createdDate": "2014-04-28T06:12:38.437Z",
   "modifiedDate": "2014-04-28T07:30:46.094Z",
   "lastViewedByMeDate": "2014-04-28T06:12:38.299Z"
  },
  {
   "createdDate": "2013-11-06T14:46:12.549Z",
   "modifiedDate": "2013-11-06T14:46:12.482Z",
   "lastViewedByMeDate": "2013-11-06T14:46:12.482Z"
  },
  {
   "createdDate": "2011-10-18T14:12:35.599Z",
   "modifiedDate": "2012-06-13T15:40:13.057Z",
   "lastViewedByMeDate": "2012-06-22T13:05:45.158Z"
  },
  {
   "createdDate": "2012-02-22T22:24:09.600Z",
   "modifiedDate": "2012-02-22T22:24:09.600Z",
   "lastViewedByMeDate": "2012-02-22T22:52:36.858Z"
  },
  {
   "createdDate": "2011-07-07T14:09:15.238Z",
   "modifiedDate": "2011-07-07T14:09:15.928Z",
   "lastViewedByMeDate": "2011-07-07T14:09:15.238Z"
  },
  {
   "createdDate": "2015-04-18T22:46:59.101Z",
   "modifiedDate": "2015-04-18T22:46:59.101Z"
  },
  {
   "createdDate": "2015-04-02T01:52:16.404Z",
   "modifiedDate": "2015-04-02T01:52:16.404Z"
  },
  {
   "createdDate": "2015-04-09T00:07:00.497Z",
   "modifiedDate": "2015-04-09T00:07:00.497Z"
  },
  {
   "createdDate": "2015-04-01T14:16:06.853Z",
   "modifiedDate": "2015-04-01T15:30:51.873Z",
   "lastViewedByMeDate": "2015-04-01T15:30:51.873Z"
  },
  {
   "createdDate": "2015-03-31T10:59:21.475Z",
   "modifiedDate": "2015-03-31T15:30:14.912Z",
   "lastViewedByMeDate": "2015-03-31T15:30:14.912Z"
  },
  {
   "createdDate": "2015-03-31T11:00:26.907Z",
   "modifiedDate": "2015-03-31T15:30:13.887Z",
   "lastViewedByMeDate": "2015-03-31T15:30:13.887Z"
  },
  {
   "createdDate": "2015-03-24T12:09:05.989Z",
   "modifiedDate": "2015-03-24T16:31:22.397Z",
   "lastViewedByMeDate": "2015-03-24T16:31:22.397Z"
  },
  {
   "createdDate": "2015-03-24T12:08:06.496Z",
   "modifiedDate": "2015-03-24T16:31:23.532Z",
   "lastViewedByMeDate": "2015-03-24T16:31:23.532Z"
  },
  {
   "createdDate": "2015-03-24T12:07:06.766Z",
   "modifiedDate": "2015-03-24T16:31:24.557Z",
   "lastViewedByMeDate": "2015-03-24T16:31:24.557Z"
  },
  {
   "createdDate": "2015-04-15T01:23:10.561Z",
   "modifiedDate": "2015-04-15T01:23:10.561Z"
  },
  {
   "createdDate": "2015-03-28T02:32:46.061Z",
   "modifiedDate": "2015-03-28T02:32:46.061Z"
  },
  {
   "createdDate": "2015-03-28T02:33:52.753Z",
   "modifiedDate": "2015-03-28T02:33:52.753Z"
  },
  {
   "createdDate": "2015-03-28T02:34:21.426Z",
   "modifiedDate": "2015-03-28T02:34:21.426Z"
  },
  {
   "createdDate": "2015-03-29T00:03:32.451Z",
   "modifiedDate": "2015-03-29T00:03:32.451Z"
  },
  {
   "createdDate": "2015-03-25T02:31:31.270Z",
   "modifiedDate": "2015-03-25T02:31:31.270Z"
  },
  {
   "createdDate": "2011-03-05T12:03:40.150Z",
   "modifiedDate": "2011-03-05T12:03:40.445Z"
  },
  {
   "createdDate": "2015-04-11T01:10:00.930Z",
   "modifiedDate": "2015-04-11T01:10:00.930Z"
  },
  {
   "createdDate": "2015-04-15T01:22:48.385Z",
   "modifiedDate": "2015-04-15T01:22:48.385Z"
  },
  {
   "createdDate": "2015-04-11T22:32:04.150Z",
   "modifiedDate": "2015-04-11T22:32:04.150Z"
  },
  {
   "createdDate": "2015-04-04T23:33:14.835Z",
   "modifiedDate": "2015-04-04T23:33:14.835Z"
  },
  {
   "createdDate": "2012-05-06T02:38:21.947Z",
   "modifiedDate": "2010-05-10T09:56:04.344Z",
   "lastViewedByMeDate": "2010-05-10T09:56:04.378Z"
  },
  {
   "createdDate": "2012-02-24T16:10:52.238Z",
   "modifiedDate": "2012-02-24T16:10:52.238Z"
  },
  {
   "createdDate": "2013-06-20T09:04:08.899Z",
   "modifiedDate": "2013-06-20T15:30:15.869Z",
   "lastViewedByMeDate": "2013-06-20T09:04:06.378Z"
  },
  {
   "createdDate": "2015-03-21T02:39:01.691Z",
   "modifiedDate": "2015-03-21T02:39:01.691Z"
  },
  {
   "createdDate": "2015-03-25T02:32:50.688Z",
   "modifiedDate": "2015-03-25T02:32:50.688Z"
  },
  {
   "createdDate": "2012-02-24T15:33:20.376Z",
   "modifiedDate": "2012-02-24T15:33:20.376Z"
  },
  {
   "createdDate": "2015-04-07T01:28:06.075Z",
   "modifiedDate": "2015-04-07T01:28:06.075Z"
  },
  {
   "createdDate": "2015-04-21T01:32:46.368Z",
   "modifiedDate": "2015-04-21T01:32:46.368Z"
  },
  {
   "createdDate": "2015-03-26T02:34:53.860Z",
   "modifiedDate": "2015-03-26T02:34:53.860Z"
  },
  {
   "createdDate": "2015-03-24T02:36:05.213Z",
   "modifiedDate": "2015-03-24T02:36:05.213Z"
  },
  {
   "createdDate": "2015-03-26T02:35:07.290Z",
   "modifiedDate": "2015-03-26T02:35:07.290Z"
  },
  {
   "createdDate": "2015-04-01T01:39:17.195Z",
   "modifiedDate": "2015-04-01T01:39:17.195Z"
  },
  {
   "createdDate": "2015-03-25T02:32:17.868Z",
   "modifiedDate": "2015-03-25T02:32:17.868Z"
  },
  {
   "createdDate": "2015-03-31T01:33:18.988Z",
   "modifiedDate": "2015-03-31T01:33:18.988Z"
  },
  {
   "createdDate": "2015-04-09T01:39:16.710Z",
   "modifiedDate": "2015-04-09T01:39:16.710Z"
  },
  {
   "createdDate": "2015-03-24T02:37:05.567Z",
   "modifiedDate": "2015-03-24T02:37:05.567Z"
  },
  {
   "createdDate": "2015-04-01T01:38:38.577Z",
   "modifiedDate": "2015-04-01T01:38:38.577Z"
  },
  {
   "createdDate": "2012-02-24T16:02:27.075Z",
   "modifiedDate": "2012-02-24T16:02:27.075Z"
  },
  {
   "createdDate": "2015-03-29T00:04:18.833Z",
   "modifiedDate": "2015-03-29T00:04:18.833Z"
  },
  {
   "createdDate": "2015-04-01T00:06:32.153Z",
   "modifiedDate": "2015-04-01T00:06:32.153Z"
  },
  {
   "createdDate": "2015-03-25T02:31:41.763Z",
   "modifiedDate": "2015-03-25T02:31:41.763Z"
  },
  {
   "createdDate": "2011-04-30T20:18:25.783Z",
   "modifiedDate": "2011-04-30T20:18:40.005Z",
   "lastViewedByMeDate": "2011-04-30T20:19:23.444Z"
  },
  {
   "createdDate": "2015-04-17T01:27:50.396Z",
   "modifiedDate": "2015-04-17T01:27:50.396Z"
  },
  {
   "createdDate": "2015-04-04T01:31:47.567Z",
   "modifiedDate": "2015-04-04T01:31:47.567Z"
  },
  {
   "createdDate": "2015-04-21T01:33:37.666Z",
   "modifiedDate": "2015-04-21T01:33:37.666Z"
  },
  {
   "createdDate": "2015-04-01T22:41:39.802Z",
   "modifiedDate": "2015-04-01T22:41:39.802Z"
  },
  {
   "createdDate": "2011-03-04T15:57:55.272Z",
   "modifiedDate": "2011-03-04T15:57:55.913Z"
  },
  {
   "createdDate": "2012-02-24T15:00:16.349Z",
   "modifiedDate": "2012-02-24T15:00:16.349Z"
  },
  {
   "createdDate": "2015-04-02T01:52:21.717Z",
   "modifiedDate": "2015-04-02T01:52:21.717Z"
  },
  {
   "createdDate": "2015-04-08T01:32:45.011Z",
   "modifiedDate": "2015-04-08T01:32:45.011Z"
  },
  {
   "createdDate": "2015-04-18T01:37:05.209Z",
   "modifiedDate": "2015-04-18T01:37:05.209Z"
  },
  {
   "createdDate": "2015-03-22T00:05:45.414Z",
   "modifiedDate": "2015-03-22T00:05:45.414Z"
  },
  {
   "createdDate": "2015-04-17T01:26:34.855Z",
   "modifiedDate": "2015-04-17T01:26:34.855Z"
  },
  {
   "createdDate": "2015-04-21T01:33:03.887Z",
   "modifiedDate": "2015-04-21T01:33:03.887Z"
  },
  {
   "createdDate": "2015-04-16T01:20:52.755Z",
   "modifiedDate": "2015-04-16T01:20:52.755Z"
  },
  {
   "createdDate": "2015-03-26T01:11:02.164Z",
   "modifiedDate": "2015-03-26T01:11:02.164Z"
  },
  {
   "createdDate": "2015-03-21T02:39:35.748Z",
   "modifiedDate": "2015-03-21T02:39:35.748Z"
  },
  {
   "createdDate": "2015-04-02T14:52:24.352Z",
   "modifiedDate": "2015-04-02T15:30:06.196Z",
   "lastViewedByMeDate": "2015-04-02T15:30:06.196Z"
  },
  {
   "createdDate": "2015-04-15T01:22:26.547Z",
   "modifiedDate": "2015-04-15T01:22:26.547Z"
  },
  {
   "createdDate": "2015-03-21T02:38:35.937Z",
   "modifiedDate": "2015-03-21T02:38:35.937Z"
  },
  {
   "createdDate": "2015-03-25T02:33:54.446Z",
   "modifiedDate": "2015-03-25T02:33:54.446Z"
  },
  {
   "createdDate": "2015-03-21T02:38:07.188Z",
   "modifiedDate": "2015-03-21T02:38:07.188Z"
  },
  {
   "createdDate": "2015-04-15T01:22:22.159Z",
   "modifiedDate": "2015-04-15T01:22:22.159Z"
  },
  {
   "createdDate": "2012-02-24T16:06:33.144Z",
   "modifiedDate": "2012-02-24T16:06:33.144Z"
  },
  {
   "createdDate": "2012-02-24T15:43:22.463Z",
   "modifiedDate": "2012-02-24T15:43:22.463Z"
  },
  {
   "createdDate": "2015-03-27T02:31:42.703Z",
   "modifiedDate": "2015-03-27T02:31:42.703Z"
  },
  {
   "createdDate": "2015-03-31T01:33:03.757Z",
   "modifiedDate": "2015-03-31T01:33:03.757Z"
  },
  {
   "createdDate": "2012-02-24T15:43:37.716Z",
   "modifiedDate": "2012-02-24T15:43:37.716Z"
  },
  {
   "createdDate": "2015-03-21T02:39:00.688Z",
   "modifiedDate": "2015-03-21T02:39:00.688Z"
  },
  {
   "createdDate": "2015-04-09T01:39:29.141Z",
   "modifiedDate": "2015-04-09T01:39:29.141Z"
  },
  {
   "createdDate": "2015-03-31T00:08:58.988Z",
   "modifiedDate": "2015-03-31T00:08:58.988Z"
  },
  {
   "createdDate": "2015-04-11T00:08:05.753Z",
   "modifiedDate": "2015-04-11T00:08:05.753Z"
  },
  {
   "createdDate": "2012-02-24T15:51:13.353Z",
   "modifiedDate": "2012-02-24T15:51:13.353Z"
  },
  {
   "createdDate": "2012-11-05T08:10:05.136Z",
   "modifiedDate": "2012-11-05T15:30:21.255Z",
   "lastViewedByMeDate": "2012-11-05T08:10:05.136Z"
  },
  {
   "createdDate": "2015-04-04T01:31:32.870Z",
   "modifiedDate": "2015-04-04T01:31:32.870Z"
  },
  {
   "createdDate": "2012-02-24T15:58:33.360Z",
   "modifiedDate": "2012-02-24T15:58:33.360Z"
  },
  {
   "createdDate": "2015-04-17T01:27:57.242Z",
   "modifiedDate": "2015-04-17T01:27:57.242Z"
  },
  {
   "createdDate": "2015-04-08T01:33:17.158Z",
   "modifiedDate": "2015-04-08T01:33:17.158Z"
  },
  {
   "createdDate": "2015-03-29T00:07:04.866Z",
   "modifiedDate": "2015-03-29T00:07:04.866Z"
  },
  {
   "createdDate": "2015-04-18T01:37:04.122Z",
   "modifiedDate": "2015-04-18T01:37:04.122Z"
  },
  {
   "createdDate": "2015-03-27T02:35:44.933Z",
   "modifiedDate": "2015-03-27T02:35:44.933Z"
  },
  {
   "createdDate": "2015-04-01T01:40:05.926Z",
   "modifiedDate": "2015-04-01T01:40:05.926Z"
  },
  {
   "createdDate": "2015-04-04T23:39:23.428Z",
   "modifiedDate": "2015-04-04T23:39:23.428Z"
  },
  {
   "createdDate": "2012-05-09T04:16:44.757Z",
   "modifiedDate": "2010-05-10T09:55:58.920Z",
   "lastViewedByMeDate": "2010-05-10T09:55:58.959Z"
  },
  {
   "createdDate": "2012-02-24T15:09:48.732Z",
   "modifiedDate": "2012-02-24T15:09:48.732Z"
  },
  {
   "createdDate": "2011-08-29T14:11:29.434Z",
   "modifiedDate": "2011-08-29T14:11:44.286Z",
   "lastViewedByMeDate": "2011-08-29T14:11:26.418Z"
  },
  {
   "createdDate": "2015-03-20T02:38:18.181Z",
   "modifiedDate": "2015-03-20T02:38:18.181Z"
  },

      

Am I the only one who has this big problem (on multiple accounts)?

+3


source to share


1 answer


Why

Since you are requesting the full text, you are presented with a list of results in order of relevance. Unless you are using the full text. This was a longstanding error that was only recently resolved.

What now?

The API does not currently provide the ability to set sort orders, so there is no way to find full text queries in the last changed order.

Alternative

While the API does not currently expose the method to sort by last modified date, you can issue multiple list queries using binding dates. By navigating through the list of dates, you can return the most recent results first, and then load older matches as needed.

For example, after your request for a full text search, you can start by adding a filter for items that have changed since the last month:

  • modifiedDate >= '2015-04-06T00:00:00'



If you need to, sort the client-side of the results after getting this result set.

For follow-up questions, link the results following this pattern:

  • modifiedDate < '2015-04-06T00:00:00' and modifiedDate >= '2015-03-06T00:00:00'

Since you are limited to the modified date, this allows you to sort these smaller subsets yourself, instead of waiting for everything to arrive. You should scale the timeframe based on how many documents you expect to return. Larger accounts may require daily or weekly time frames.

Consider

Disclaimer: You will know your use case, so this may not apply to how you use full text search.

Check if / when you really want the search results to return in chronological order. For example, if the user searched May 2010 Budget

, documents containing only 1 of these three words might be returned first, whereas the 2010 budget file might be # 10000 in the list and will never be displayed by the user.

+1


source







All Articles