{"action":"created","comment":{"url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments/69664984","id":69664984,"diff_hunk":"@@ -73,7 +79,15 @@ def final_price\n \n   def as_json(options = { })\n     h = super(options)\n-    h[:final_price] = final_price\n+    h[:final_price] = final_price if final_price\n     h\n   end\n-end\n\\ No newline at end of file\n+\n+  def as_indexed_json(options={})\n+    {\n+        id: id,\n+        name: name,\n+        description: description\n+    }\n+  end","path":"app/models/item.rb","position":28,"original_position":28,"commit_id":"1ed203fa50a362c67925e2805eeadb22b912c5f9","original_commit_id":"1ed203fa50a362c67925e2805eeadb22b912c5f9","user":{"login":"StevenKo","id":1100488,"avatar_url":"https://avatars.githubusercontent.com/u/1100488?v=3","gravatar_id":"","url":"https://api.github.com/users/StevenKo","html_url":"https://github.com/StevenKo","followers_url":"https://api.github.com/users/StevenKo/followers","following_url":"https://api.github.com/users/StevenKo/following{/other_user}","gists_url":"https://api.github.com/users/StevenKo/gists{/gist_id}","starred_url":"https://api.github.com/users/StevenKo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StevenKo/subscriptions","organizations_url":"https://api.github.com/users/StevenKo/orgs","repos_url":"https://api.github.com/users/StevenKo/repos","events_url":"https://api.github.com/users/StevenKo/events{/privacy}","received_events_url":"https://api.github.com/users/StevenKo/received_events","type":"User","site_admin":false},"body":"`class Novel < ActiveRecord::Base\r\n  include Elasticsearch::Model\r\n  include Elasticsearch::Model::Callbacks\r\n\r\n  attr_accessible :name, :author, :description, :pic, :category_id, :article_num, :last_update, :is_serializing, :is_category_recommend, :is_category_hot, :is_category_this_week_hot, :is_classic, :is_classic_action, :is_show, :link\r\n  belongs_to :category\r\n  has_many :articles\r\n\r\n  scope :show, where(:is_show => true)\r\n\r\n  mapping do\r\n    indexes :name, type: 'string'\r\n    indexes :author, type: 'string'\r\n  end\r\n\r\n  def as_indexed_json(options={})\r\n    self.as_json(only: [:name,:author])\r\n  end\r\n\r\n  after_create :create_index\r\n  after_update :update_index\r\n  after_destroy :delete_index\r\n\r\n  def recrawl_articles_text\r\n    Article.where(\"novel_id = #{id} and is_show = true\").select(\"id\").find_in_batches(:batch_size => 100) do |articles|\r\n      articles.each do |article|\r\n        texts = ArticleText.select(\"id\").where(\"article_id = #{article.id}\")\r\n        unless texts.present?\r\n          if link.index('33yq')\r\n            YqArticleWorker.perform_async(article.id)\r\n          else\r\n            ArticleWorker.perform_async(article.id)\r\n          end\r\n        end \r\n      end \r\n    end\r\n  end\r\n\r\n  def update_num\r\n    self.article_num = articles.show.size.to_s + \"篇\"\r\n    self.save\r\n  end\r\n\r\n  def create_index\r\n    __elasticsearch__.index_document\r\n  end\r\n\r\n  def update_index\r\n    __elasticsearch__.update_document\r\n  end\r\n\r\n  def delete_index\r\n    __elasticsearch__.delete_document\r\n  end\r\nend\r\n`","created_at":"2016-07-06T01:37:12Z","updated_at":"2016-07-06T01:37:12Z","html_url":"https://github.com/kosbrother/mongmongwoo/pull/114#discussion_r69664984","pull_request_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114","_links":{"self":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments/69664984"},"html":{"href":"https://github.com/kosbrother/mongmongwoo/pull/114#discussion_r69664984"},"pull_request":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114","id":76212202,"html_url":"https://github.com/kosbrother/mongmongwoo/pull/114","diff_url":"https://github.com/kosbrother/mongmongwoo/pull/114.diff","patch_url":"https://github.com/kosbrother/mongmongwoo/pull/114.patch","issue_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/114","number":114,"state":"open","locked":false,"title":"Api search","user":{"login":"varbark","id":13852334,"avatar_url":"https://avatars.githubusercontent.com/u/13852334?v=3","gravatar_id":"","url":"https://api.github.com/users/varbark","html_url":"https://github.com/varbark","followers_url":"https://api.github.com/users/varbark/followers","following_url":"https://api.github.com/users/varbark/following{/other_user}","gists_url":"https://api.github.com/users/varbark/gists{/gist_id}","starred_url":"https://api.github.com/users/varbark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varbark/subscriptions","organizations_url":"https://api.github.com/users/varbark/orgs","repos_url":"https://api.github.com/users/varbark/repos","events_url":"https://api.github.com/users/varbark/events{/privacy}","received_events_url":"https://api.github.com/users/varbark/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-05T02:42:03Z","updated_at":"2016-07-06T01:37:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba3dc526220ff3a27645ebf2e09d9e62afc2d59f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114/commits","review_comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114/comments","review_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/114/comments","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/1ed203fa50a362c67925e2805eeadb22b912c5f9","head":{"label":"kosbrother:api-search","ref":"api-search","sha":"1ed203fa50a362c67925e2805eeadb22b912c5f9","user":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"repo":{"id":56124462,"name":"mongmongwoo","full_name":"kosbrother/mongmongwoo","owner":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kosbrother/mongmongwoo","description":"","fork":false,"url":"https://api.github.com/repos/kosbrother/mongmongwoo","forks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/forks","keys_url":"https://api.github.com/repos/kosbrother/mongmongwoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kosbrother/mongmongwoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kosbrother/mongmongwoo/teams","hooks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/hooks","issue_events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/events{/number}","events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/events","assignees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/assignees{/user}","branches_url":"https://api.github.com/repos/kosbrother/mongmongwoo/branches{/branch}","tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/tags","blobs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/{sha}","languages_url":"https://api.github.com/repos/kosbrother/mongmongwoo/languages","stargazers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/stargazers","contributors_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contributors","subscribers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscribers","subscription_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscription","commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contents/{+path}","compare_url":"https://api.github.com/repos/kosbrother/mongmongwoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kosbrother/mongmongwoo/merges","archive_url":"https://api.github.com/repos/kosbrother/mongmongwoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kosbrother/mongmongwoo/downloads","issues_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues{/number}","pulls_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls{/number}","milestones_url":"https://api.github.com/repos/kosbrother/mongmongwoo/milestones{/number}","notifications_url":"https://api.github.com/repos/kosbrother/mongmongwoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kosbrother/mongmongwoo/labels{/name}","releases_url":"https://api.github.com/repos/kosbrother/mongmongwoo/releases{/id}","deployments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/deployments","created_at":"2016-04-13T05:46:41Z","updated_at":"2016-04-13T05:47:43Z","pushed_at":"2016-07-05T11:03:11Z","git_url":"git://github.com/kosbrother/mongmongwoo.git","ssh_url":"git@github.com:kosbrother/mongmongwoo.git","clone_url":"https://github.com/kosbrother/mongmongwoo.git","svn_url":"https://github.com/kosbrother/mongmongwoo","homepage":null,"size":4950,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"kosbrother:master","ref":"master","sha":"b425fc7018211096bb27c91878311de87128a223","user":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"repo":{"id":56124462,"name":"mongmongwoo","full_name":"kosbrother/mongmongwoo","owner":{"login":"kosbrother","id":14856209,"avatar_url":"https://avatars.githubusercontent.com/u/14856209?v=3","gravatar_id":"","url":"https://api.github.com/users/kosbrother","html_url":"https://github.com/kosbrother","followers_url":"https://api.github.com/users/kosbrother/followers","following_url":"https://api.github.com/users/kosbrother/following{/other_user}","gists_url":"https://api.github.com/users/kosbrother/gists{/gist_id}","starred_url":"https://api.github.com/users/kosbrother/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosbrother/subscriptions","organizations_url":"https://api.github.com/users/kosbrother/orgs","repos_url":"https://api.github.com/users/kosbrother/repos","events_url":"https://api.github.com/users/kosbrother/events{/privacy}","received_events_url":"https://api.github.com/users/kosbrother/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kosbrother/mongmongwoo","description":"","fork":false,"url":"https://api.github.com/repos/kosbrother/mongmongwoo","forks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/forks","keys_url":"https://api.github.com/repos/kosbrother/mongmongwoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kosbrother/mongmongwoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kosbrother/mongmongwoo/teams","hooks_url":"https://api.github.com/repos/kosbrother/mongmongwoo/hooks","issue_events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/events{/number}","events_url":"https://api.github.com/repos/kosbrother/mongmongwoo/events","assignees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/assignees{/user}","branches_url":"https://api.github.com/repos/kosbrother/mongmongwoo/branches{/branch}","tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/tags","blobs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/{sha}","languages_url":"https://api.github.com/repos/kosbrother/mongmongwoo/languages","stargazers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/stargazers","contributors_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contributors","subscribers_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscribers","subscription_url":"https://api.github.com/repos/kosbrother/mongmongwoo/subscription","commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/kosbrother/mongmongwoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/kosbrother/mongmongwoo/contents/{+path}","compare_url":"https://api.github.com/repos/kosbrother/mongmongwoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kosbrother/mongmongwoo/merges","archive_url":"https://api.github.com/repos/kosbrother/mongmongwoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kosbrother/mongmongwoo/downloads","issues_url":"https://api.github.com/repos/kosbrother/mongmongwoo/issues{/number}","pulls_url":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls{/number}","milestones_url":"https://api.github.com/repos/kosbrother/mongmongwoo/milestones{/number}","notifications_url":"https://api.github.com/repos/kosbrother/mongmongwoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kosbrother/mongmongwoo/labels{/name}","releases_url":"https://api.github.com/repos/kosbrother/mongmongwoo/releases{/id}","deployments_url":"https://api.github.com/repos/kosbrother/mongmongwoo/deployments","created_at":"2016-04-13T05:46:41Z","updated_at":"2016-04-13T05:47:43Z","pushed_at":"2016-07-05T11:03:11Z","git_url":"git://github.com/kosbrother/mongmongwoo.git","ssh_url":"git@github.com:kosbrother/mongmongwoo.git","clone_url":"https://github.com/kosbrother/mongmongwoo.git","svn_url":"https://github.com/kosbrother/mongmongwoo","homepage":null,"size":4950,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114"},"html":{"href":"https://github.com/kosbrother/mongmongwoo/pull/114"},"issue":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/114"},"comments":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/kosbrother/mongmongwoo/statuses/1ed203fa50a362c67925e2805eeadb22b912c5f9"}}}}
{"actor":{"display_login":"StevenKo"}}