{"action":"created","issue":{"url":"https://api.github.com/repos/luci/gae/issues/65","repository_url":"https://api.github.com/repos/luci/gae","labels_url":"https://api.github.com/repos/luci/gae/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/luci/gae/issues/65/comments","events_url":"https://api.github.com/repos/luci/gae/issues/65/events","html_url":"https://github.com/luci/gae/issues/65","id":188888830,"number":65,"title":"search API support","user":{"login":"bsr203","id":1966521,"avatar_url":"https://avatars.githubusercontent.com/u/1966521?v=3","gravatar_id":"","url":"https://api.github.com/users/bsr203","html_url":"https://github.com/bsr203","followers_url":"https://api.github.com/users/bsr203/followers","following_url":"https://api.github.com/users/bsr203/following{/other_user}","gists_url":"https://api.github.com/users/bsr203/gists{/gist_id}","starred_url":"https://api.github.com/users/bsr203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsr203/subscriptions","organizations_url":"https://api.github.com/users/bsr203/orgs","repos_url":"https://api.github.com/users/bsr203/repos","events_url":"https://api.github.com/users/bsr203/events{/privacy}","received_events_url":"https://api.github.com/users/bsr203/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-12T03:10:46Z","updated_at":"2016-11-12T03:54:39Z","closed_at":null,"body":"Hi,\r\n\r\nIs it possible to add support for search API?\r\n\r\nI tried to use `aetest.NewContext()` for search, but met with following difficulty.\r\nIt works if I just insert to search index, but in normal usage, I persist the entities (datastore + search index) same time. My datastore code persist the entities through `\t\"github.com/luci/gae/service/datastore\"`, and when use aetest context, I get following exception.\r\n\r\n```\r\n--- FAIL: TestInsert (2.89s)\r\npanic: runtime error: invalid memory address or nil pointer dereference [recovered]\r\n\tpanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x12860d]\r\n\r\ngoroutine 7 [running]:\r\npanic(0x492da0, 0xc4200121d0)\r\n\t/usr/local/go/src/runtime/panic.go:500 +0x1a1\r\ntesting.tRunner.func1(0xc42008eb40)\r\n\t/usr/local/go/src/testing/testing.go:579 +0x25d\r\npanic(0x492da0, 0xc4200121d0)\r\n\t/usr/local/go/src/runtime/panic.go:458 +0x243\r\ngithub.com/luci/gae/service/datastore.GetKeyContext(0x76fe40, 0xc4201c8b70, 0x0, 0xc42004fc58, 0x2, 0x2)\r\n\t/Users/bsr/go/src/github.com/luci/gae/service/datastore/context.go:93 +0x4d\r\ngithub.com/luci/gae/service/datastore.NewKey(0x76fe40, 0xc4201c8b70, 0xc42018ec04, 0x7, 0xc420190a40, 0x18, 0x0, 0x0, 0x76fe40)\r\n\t/Users/bsr/go/src/github.com/luci/gae/service/datastore/interface.go:201 +0x4d\r\n\r\n```\r\n\r\nthis is the code where it throws\r\n\r\n```\r\n// GetKeyContext returns the KeyContext whose AppID and Namespace match those\r\n// installed in the supplied Context.\r\nfunc GetKeyContext(c context.Context) KeyContext {\r\n\tri := info.Raw(c)\r\n\treturn MkKeyContext(ri.FullyQualifiedAppID(), ri.GetNamespace())  // <--- line 93\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/luci/gae/issues/comments/260099784","html_url":"https://github.com/luci/gae/issues/65#issuecomment-260099784","issue_url":"https://api.github.com/repos/luci/gae/issues/65","id":260099784,"user":{"login":"danjacques","id":9965104,"avatar_url":"https://avatars.githubusercontent.com/u/9965104?v=3","gravatar_id":"","url":"https://api.github.com/users/danjacques","html_url":"https://github.com/danjacques","followers_url":"https://api.github.com/users/danjacques/followers","following_url":"https://api.github.com/users/danjacques/following{/other_user}","gists_url":"https://api.github.com/users/danjacques/gists{/gist_id}","starred_url":"https://api.github.com/users/danjacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danjacques/subscriptions","organizations_url":"https://api.github.com/users/danjacques/orgs","repos_url":"https://api.github.com/users/danjacques/repos","events_url":"https://api.github.com/users/danjacques/events{/privacy}","received_events_url":"https://api.github.com/users/danjacques/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T03:54:39Z","updated_at":"2016-11-12T03:54:39Z","body":"Yeah unfortunately the `Context`s are not interchangeable; an AppEngine SDK `Context` is independent from a `luci/gae` `Context` by design, since the two handle data differently.\r\n\r\nAlthough it's definitely something that would be good to add, search API support isn't currently a high priority for us. In the meantime, you could maintain two `Context`s, one for AppEngine SDK operations and one for `luci/gae`.\r\n\r\nAnother option would be to augment `impl/memory` with a `With...` style method to install `luci/gae` services into a supplied `Context` (instead of generating a new one). This would let you install `luci/gae` into the existing `aetest` `Context`. Think that would do it?"}}
{"actor":{"display_login":"danjacques"}}