{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/419","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/419/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/419/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/issues/419","id":114639221,"number":419,"title":"Import/export Document","user":{"login":"quartzmo","id":205445,"avatar_url":"https://avatars.githubusercontent.com/u/205445?v=3","gravatar_id":"","url":"https://api.github.com/users/quartzmo","html_url":"https://github.com/quartzmo","followers_url":"https://api.github.com/users/quartzmo/followers","following_url":"https://api.github.com/users/quartzmo/following{/other_user}","gists_url":"https://api.github.com/users/quartzmo/gists{/gist_id}","starred_url":"https://api.github.com/users/quartzmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quartzmo/subscriptions","organizations_url":"https://api.github.com/users/quartzmo/orgs","repos_url":"https://api.github.com/users/quartzmo/repos","events_url":"https://api.github.com/users/quartzmo/events{/privacy}","received_events_url":"https://api.github.com/users/quartzmo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/labels/search","name":"search","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-02T17:08:03Z","updated_at":"2015-11-20T19:01:29Z","closed_at":null,"body":"In #413, @blowmage wrote the comment pasted below. I'm extracting it to its own issue.\r\n\r\n====================================\r\n\r\nThe other thought I've been having about the search documents is the JSON API document structure:\r\n\r\n```json\r\n{\r\n  \"docId\": \"doc123\",\r\n  \"rank\": 123456789,\r\n  \"fields\": {\r\n    \"title\": {\r\n      \"values\": [\r\n        {\r\n          \"stringFormat\": \"TEXT\",\r\n          \"lang\": \"en\",\r\n          \"stringValue\": \"Hello Gcloud!\"\r\n        }\r\n      ]\r\n    },\r\n    \"body\": {\r\n      \"values\": [\r\n        {\r\n          \"stringFormat\": \"TEXT\",\r\n          \"lang\": \"en\",\r\n          \"stringValue\": \"gcloud is a client library for accessing Google Cloud Platform services that ...\"\r\n        },\r\n        {\r\n          \"stringFormat\": \"HTML\",\r\n          \"lang\": \"en\",\r\n          \"stringValue\": \"<p><code>gcloud</code> is a client library for accessing Google Cloud Platform services that ...</p>\"\r\n        },\r\n        {\r\n          \"stringFormat\": \"HTML\",\r\n          \"lang\": \"eo\",\r\n          \"stringValue\": \"<p><code>gcloud</code> estas kliento biblioteko por aliranta Google Nubo Platformo servoj kiu ...</p>\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nI think that we should allow both importing and exporting JSON strings and Hash objects that adhere to this structure. Working with a document object would be easier for sure, but I think there are advantages to allowing folks to use this data structure as well. If they want to.\r\n\r\n```ruby\r\ndocument = index.document \"doc123\"\r\ndocument.to_json #=> \"{\\\"docId\\\": \\\"doc123\\\",\\\"rank\\\": 123456789, ... }\"\r\ndocument.to_hash #=> {\"docId\"=>\"doc123\",\"rank\"=>123456789, ... }\r\n\r\nindex.import_json \"doc456\", \"{\\\"docId\\\": \\\"doc456\\\",\\\"rank\\\": 123456790, ... }\"\r\nindex.import_hash \"doc789\", {\"docId\"=>\"doc789\",\"rank\"=>123456791, ... }\r\n```"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/comments/158495431","html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/issues/419#issuecomment-158495431","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/419","id":158495431,"user":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T19:01:29Z","updated_at":"2015-11-20T19:01:29Z","body":"The further we got into Search the less we found value in this feature. Dropping from the Milestone. Closing until someone has a need for this."}}