{"action":"created","comment":{"url":"https://api.github.com/repos/hahuang65/changeling/pulls/comments/46523200","id":46523200,"diff_hunk":"@@ -199,7 +199,7 @@\n           it \"should search with a filter on the field if one is passed in\" do\n             expect(@search).to receive(:find_by).with(hash_including(\n               :filters => [\n-                { :klass => @klass.klassify(@object) },\n+                { :klass => [@klass.klassify(@object)] },","path":"spec/lib/changeling/models/logling_spec.rb","position":23,"original_position":23,"commit_id":"f248ca7bd81a3d64d944cd84ce5763cd21474f12","original_commit_id":"f248ca7bd81a3d64d944cd84ce5763cd21474f12","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Use the new Ruby 1.9 hash syntax.","created_at":"2015-12-03T08:16:47Z","updated_at":"2015-12-03T08:16:47Z","html_url":"https://github.com/hahuang65/changeling/pull/3#discussion_r46523200","pull_request_url":"https://api.github.com/repos/hahuang65/changeling/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/comments/46523200"},"html":{"href":"https://github.com/hahuang65/changeling/pull/3#discussion_r46523200"},"pull_request":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/hahuang65/changeling/pulls/3","id":52501596,"html_url":"https://github.com/hahuang65/changeling/pull/3","diff_url":"https://github.com/hahuang65/changeling/pull/3.diff","patch_url":"https://github.com/hahuang65/changeling/pull/3.patch","issue_url":"https://api.github.com/repos/hahuang65/changeling/issues/3","number":3,"state":"open","locked":false,"title":"Split nested klass name to words","user":{"login":"zhuochun","id":842419,"avatar_url":"https://avatars.githubusercontent.com/u/842419?v=3","gravatar_id":"","url":"https://api.github.com/users/zhuochun","html_url":"https://github.com/zhuochun","followers_url":"https://api.github.com/users/zhuochun/followers","following_url":"https://api.github.com/users/zhuochun/following{/other_user}","gists_url":"https://api.github.com/users/zhuochun/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuochun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuochun/subscriptions","organizations_url":"https://api.github.com/users/zhuochun/orgs","repos_url":"https://api.github.com/users/zhuochun/repos","events_url":"https://api.github.com/users/zhuochun/events{/privacy}","received_events_url":"https://api.github.com/users/zhuochun/received_events","type":"User","site_admin":false},"body":"ElasticSearch reverse index `nested/class_name` into two, e.g. `nested` and `class_name`. When use `object.loglings`, no data is found with filter term on `klass => ['nested/class_name']`.\r\n\r\nThis diff change it to filter term with `klass => ['nested', 'class_name']`.\r\n\r\nThis is a backward compatible fix to support nested class name.\r\n\r\nA better fix would change the mapping to use `not_analyzed` index. Then no split required.\r\n\r\n```\r\nindexes :klass, :type => \"string\", :index => :not_analyzed\r\n```\r\n\r\nhttps://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html#_index_2\r\n\r\nTest:\r\n\r\n```\r\nresults = Changeling::Models::Logling.search per_page: 10 do\r\n  query do\r\n    filtered do\r\n      query { all }\r\n      filter :terms, { klass: ['incentive/scheme'] }\r\n      filter :terms, { oid: ['1'] }\r\n    end\r\n  end\r\nend.results # => [] empty array\r\n```\r\n\r\n```\r\nresults = Changeling::Models::Logling.search per_page: 10 do\r\n  query do\r\n    filtered do\r\n      query { all }\r\n      filter :terms, { klass: ['incentive', 'scheme'] }\r\n      filter :terms, { oid: ['1'] }\r\n    end\r\n  end\r\nend.results # => [#<Changeling::Models::Logling:0x007f567a8ef878>]\r\n```\r\n","created_at":"2015-12-03T07:50:22Z","updated_at":"2015-12-03T08:16:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d29c613cc7246fa9bafe794a0f33e8f54c614fca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hahuang65/changeling/pulls/3/commits","review_comments_url":"https://api.github.com/repos/hahuang65/changeling/pulls/3/comments","review_comment_url":"https://api.github.com/repos/hahuang65/changeling/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hahuang65/changeling/issues/3/comments","statuses_url":"https://api.github.com/repos/hahuang65/changeling/statuses/f248ca7bd81a3d64d944cd84ce5763cd21474f12","head":{"label":"zhuochun:history-of-nested-klass","ref":"history-of-nested-klass","sha":"f248ca7bd81a3d64d944cd84ce5763cd21474f12","user":{"login":"zhuochun","id":842419,"avatar_url":"https://avatars.githubusercontent.com/u/842419?v=3","gravatar_id":"","url":"https://api.github.com/users/zhuochun","html_url":"https://github.com/zhuochun","followers_url":"https://api.github.com/users/zhuochun/followers","following_url":"https://api.github.com/users/zhuochun/following{/other_user}","gists_url":"https://api.github.com/users/zhuochun/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuochun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuochun/subscriptions","organizations_url":"https://api.github.com/users/zhuochun/orgs","repos_url":"https://api.github.com/users/zhuochun/repos","events_url":"https://api.github.com/users/zhuochun/events{/privacy}","received_events_url":"https://api.github.com/users/zhuochun/received_events","type":"User","site_admin":false},"repo":{"id":47315558,"name":"changeling","full_name":"zhuochun/changeling","owner":{"login":"zhuochun","id":842419,"avatar_url":"https://avatars.githubusercontent.com/u/842419?v=3","gravatar_id":"","url":"https://api.github.com/users/zhuochun","html_url":"https://github.com/zhuochun","followers_url":"https://api.github.com/users/zhuochun/followers","following_url":"https://api.github.com/users/zhuochun/following{/other_user}","gists_url":"https://api.github.com/users/zhuochun/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuochun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuochun/subscriptions","organizations_url":"https://api.github.com/users/zhuochun/orgs","repos_url":"https://api.github.com/users/zhuochun/repos","events_url":"https://api.github.com/users/zhuochun/events{/privacy}","received_events_url":"https://api.github.com/users/zhuochun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhuochun/changeling","description":"A simple, yet flexible solution to tracking changes made to objects in your database.","fork":true,"url":"https://api.github.com/repos/zhuochun/changeling","forks_url":"https://api.github.com/repos/zhuochun/changeling/forks","keys_url":"https://api.github.com/repos/zhuochun/changeling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhuochun/changeling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhuochun/changeling/teams","hooks_url":"https://api.github.com/repos/zhuochun/changeling/hooks","issue_events_url":"https://api.github.com/repos/zhuochun/changeling/issues/events{/number}","events_url":"https://api.github.com/repos/zhuochun/changeling/events","assignees_url":"https://api.github.com/repos/zhuochun/changeling/assignees{/user}","branches_url":"https://api.github.com/repos/zhuochun/changeling/branches{/branch}","tags_url":"https://api.github.com/repos/zhuochun/changeling/tags","blobs_url":"https://api.github.com/repos/zhuochun/changeling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhuochun/changeling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhuochun/changeling/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhuochun/changeling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhuochun/changeling/statuses/{sha}","languages_url":"https://api.github.com/repos/zhuochun/changeling/languages","stargazers_url":"https://api.github.com/repos/zhuochun/changeling/stargazers","contributors_url":"https://api.github.com/repos/zhuochun/changeling/contributors","subscribers_url":"https://api.github.com/repos/zhuochun/changeling/subscribers","subscription_url":"https://api.github.com/repos/zhuochun/changeling/subscription","commits_url":"https://api.github.com/repos/zhuochun/changeling/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhuochun/changeling/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhuochun/changeling/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhuochun/changeling/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhuochun/changeling/contents/{+path}","compare_url":"https://api.github.com/repos/zhuochun/changeling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhuochun/changeling/merges","archive_url":"https://api.github.com/repos/zhuochun/changeling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhuochun/changeling/downloads","issues_url":"https://api.github.com/repos/zhuochun/changeling/issues{/number}","pulls_url":"https://api.github.com/repos/zhuochun/changeling/pulls{/number}","milestones_url":"https://api.github.com/repos/zhuochun/changeling/milestones{/number}","notifications_url":"https://api.github.com/repos/zhuochun/changeling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhuochun/changeling/labels{/name}","releases_url":"https://api.github.com/repos/zhuochun/changeling/releases{/id}","created_at":"2015-12-03T07:28:38Z","updated_at":"2015-12-03T07:28:39Z","pushed_at":"2015-12-03T08:16:43Z","git_url":"git://github.com/zhuochun/changeling.git","ssh_url":"git@github.com:zhuochun/changeling.git","clone_url":"https://github.com/zhuochun/changeling.git","svn_url":"https://github.com/zhuochun/changeling","homepage":null,"size":96,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hahuang65:master","ref":"master","sha":"79a0bfb02fce73b73937ea69864483a570838cb5","user":{"login":"hahuang65","id":280972,"avatar_url":"https://avatars.githubusercontent.com/u/280972?v=3","gravatar_id":"","url":"https://api.github.com/users/hahuang65","html_url":"https://github.com/hahuang65","followers_url":"https://api.github.com/users/hahuang65/followers","following_url":"https://api.github.com/users/hahuang65/following{/other_user}","gists_url":"https://api.github.com/users/hahuang65/gists{/gist_id}","starred_url":"https://api.github.com/users/hahuang65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hahuang65/subscriptions","organizations_url":"https://api.github.com/users/hahuang65/orgs","repos_url":"https://api.github.com/users/hahuang65/repos","events_url":"https://api.github.com/users/hahuang65/events{/privacy}","received_events_url":"https://api.github.com/users/hahuang65/received_events","type":"User","site_admin":false},"repo":{"id":5049924,"name":"changeling","full_name":"hahuang65/changeling","owner":{"login":"hahuang65","id":280972,"avatar_url":"https://avatars.githubusercontent.com/u/280972?v=3","gravatar_id":"","url":"https://api.github.com/users/hahuang65","html_url":"https://github.com/hahuang65","followers_url":"https://api.github.com/users/hahuang65/followers","following_url":"https://api.github.com/users/hahuang65/following{/other_user}","gists_url":"https://api.github.com/users/hahuang65/gists{/gist_id}","starred_url":"https://api.github.com/users/hahuang65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hahuang65/subscriptions","organizations_url":"https://api.github.com/users/hahuang65/orgs","repos_url":"https://api.github.com/users/hahuang65/repos","events_url":"https://api.github.com/users/hahuang65/events{/privacy}","received_events_url":"https://api.github.com/users/hahuang65/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hahuang65/changeling","description":"A simple, yet flexible solution to tracking changes made to objects in your database.","fork":false,"url":"https://api.github.com/repos/hahuang65/changeling","forks_url":"https://api.github.com/repos/hahuang65/changeling/forks","keys_url":"https://api.github.com/repos/hahuang65/changeling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hahuang65/changeling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hahuang65/changeling/teams","hooks_url":"https://api.github.com/repos/hahuang65/changeling/hooks","issue_events_url":"https://api.github.com/repos/hahuang65/changeling/issues/events{/number}","events_url":"https://api.github.com/repos/hahuang65/changeling/events","assignees_url":"https://api.github.com/repos/hahuang65/changeling/assignees{/user}","branches_url":"https://api.github.com/repos/hahuang65/changeling/branches{/branch}","tags_url":"https://api.github.com/repos/hahuang65/changeling/tags","blobs_url":"https://api.github.com/repos/hahuang65/changeling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hahuang65/changeling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hahuang65/changeling/git/refs{/sha}","trees_url":"https://api.github.com/repos/hahuang65/changeling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hahuang65/changeling/statuses/{sha}","languages_url":"https://api.github.com/repos/hahuang65/changeling/languages","stargazers_url":"https://api.github.com/repos/hahuang65/changeling/stargazers","contributors_url":"https://api.github.com/repos/hahuang65/changeling/contributors","subscribers_url":"https://api.github.com/repos/hahuang65/changeling/subscribers","subscription_url":"https://api.github.com/repos/hahuang65/changeling/subscription","commits_url":"https://api.github.com/repos/hahuang65/changeling/commits{/sha}","git_commits_url":"https://api.github.com/repos/hahuang65/changeling/git/commits{/sha}","comments_url":"https://api.github.com/repos/hahuang65/changeling/comments{/number}","issue_comment_url":"https://api.github.com/repos/hahuang65/changeling/issues/comments{/number}","contents_url":"https://api.github.com/repos/hahuang65/changeling/contents/{+path}","compare_url":"https://api.github.com/repos/hahuang65/changeling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hahuang65/changeling/merges","archive_url":"https://api.github.com/repos/hahuang65/changeling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hahuang65/changeling/downloads","issues_url":"https://api.github.com/repos/hahuang65/changeling/issues{/number}","pulls_url":"https://api.github.com/repos/hahuang65/changeling/pulls{/number}","milestones_url":"https://api.github.com/repos/hahuang65/changeling/milestones{/number}","notifications_url":"https://api.github.com/repos/hahuang65/changeling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hahuang65/changeling/labels{/name}","releases_url":"https://api.github.com/repos/hahuang65/changeling/releases{/id}","created_at":"2012-07-14T18:26:52Z","updated_at":"2015-10-13T00:54:22Z","pushed_at":"2015-12-03T08:16:43Z","git_url":"git://github.com/hahuang65/changeling.git","ssh_url":"git@github.com:hahuang65/changeling.git","clone_url":"https://github.com/hahuang65/changeling.git","svn_url":"https://github.com/hahuang65/changeling","homepage":null,"size":461,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/3"},"html":{"href":"https://github.com/hahuang65/changeling/pull/3"},"issue":{"href":"https://api.github.com/repos/hahuang65/changeling/issues/3"},"comments":{"href":"https://api.github.com/repos/hahuang65/changeling/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hahuang65/changeling/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/hahuang65/changeling/statuses/f248ca7bd81a3d64d944cd84ce5763cd21474f12"}}}}