{"action":"created","comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/82594192","pull_request_review_id":3489839,"id":82594192,"diff_hunk":"@@ -32,10 +32,121 @@ const recipe &recipe_dictionary::get_uncraft( const itype_id &id )\n std::vector<const recipe *> recipe_subset::search( const std::string &txt ) const\n {\n     std::vector<const recipe *> res;\n-\n+    std::vector<std::string> subqueries;\n+    std::vector<std::string> requirement_qualities,\n+        names,\n+        components,\n+        tools,\n+        result_qualities,\n+        skills;\n+    std::string pattern = txt; //Copy the search string.\n+    size_t split;\n+    if( ( split = pattern.find( ',' ) ) != std::string::npos ) {\n+        while( ( split = pattern.find( ',' ) ) != std::string::npos ) {\n+            subqueries.push_back( pattern.substr( 0, split ) );\n+            pattern = pattern.substr( split + 1 );\n+        }\n+    } else {\n+        subqueries.push_back( pattern );\n+    }\n+    for( const auto &query : subqueries ) {\n+        if( ( split = query.find( ':' ) ) == std::string::npos ) { //search by name\n+            names.push_back( query );\n+        } else {\n+            switch( query[split - 1] ) { //Find the appropriate key\n+                case 'Q'://search by quality\n+                    result_qualities.push_back( query.substr( split + 1 ) );\n+                    break;\n+                case 'q':\n+                    requirement_qualities.push_back( query.substr( split + 1 ) );\n+                    break;\n+                case 'c'://search by component\n+                    components.push_back( query.substr( split + 1 ) );\n+                    break;\n+                case 't'://search by requirement\n+                    tools.push_back( query.substr( split + 1 ) );\n+                    break;\n+                case 's'://search by skill.\n+                    skills.push_back( query.substr( split + 1 ) );\n+                    break;\n+            }\n+        }\n+    }\n+    auto name_match =\n+    [names]( const recipe * r ) {\n+        return std::any_of( names.begin(), names.end(),\n+        [r]( const std::string & name ) {","path":"src/recipe_dictionary.cpp","position":48,"original_position":48,"commit_id":"c4d451cd864c61382d614745f0594b82c4d7f5a9","original_commit_id":"c4d451cd864c61382d614745f0594b82c4d7f5a9","user":{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false},"body":"Try for the nested lambda on one line maybe? It's quite hard to read this section","created_at":"2016-10-10T12:32:39Z","updated_at":"2016-10-10T12:36:37Z","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696#discussion_r82594192","pull_request_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696","_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments/82594192"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696#discussion_r82594192"},"pull_request":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696"}}},"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696","id":88562092,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696.patch","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/18696","number":18696,"state":"open","locked":false,"title":"Fix recipe search prefixes [RDY] [CR]","user":{"login":"jaked122","id":334061,"avatar_url":"https://avatars.githubusercontent.com/u/334061?v=3","gravatar_id":"","url":"https://api.github.com/users/jaked122","html_url":"https://github.com/jaked122","followers_url":"https://api.github.com/users/jaked122/followers","following_url":"https://api.github.com/users/jaked122/following{/other_user}","gists_url":"https://api.github.com/users/jaked122/gists{/gist_id}","starred_url":"https://api.github.com/users/jaked122/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaked122/subscriptions","organizations_url":"https://api.github.com/users/jaked122/orgs","repos_url":"https://api.github.com/users/jaked122/repos","events_url":"https://api.github.com/users/jaked122/events{/privacy}","received_events_url":"https://api.github.com/users/jaked122/received_events","type":"User","site_admin":false},"body":"So, this seems to work for me.\r\n\r\nI don't expect that I've handled searching for qualities in a manner that will make internationalization easy, so I'm not convinced that I have that part right.\r\n\r\nOtherwise, I've not finished implementing some of the prefixes, and I'm not sure that I've done the matching in the preferred manner.\r\n\r\nIn any case, any advice would be welcome.\r\n\r\nIn any case (in case the commit alone doesn't trigger the mention), this fixes #18573.\r\n\r\n","created_at":"2016-10-08T23:11:58Z","updated_at":"2016-10-10T12:36:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55b71b0040fcbb345a0bdf96c8744528eb0bdf99","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696/commits","review_comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696/comments","review_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/18696/comments","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/c4d451cd864c61382d614745f0594b82c4d7f5a9","head":{"label":"jaked122:recipe_search_fix","ref":"recipe_search_fix","sha":"c4d451cd864c61382d614745f0594b82c4d7f5a9","user":{"login":"jaked122","id":334061,"avatar_url":"https://avatars.githubusercontent.com/u/334061?v=3","gravatar_id":"","url":"https://api.github.com/users/jaked122","html_url":"https://github.com/jaked122","followers_url":"https://api.github.com/users/jaked122/followers","following_url":"https://api.github.com/users/jaked122/following{/other_user}","gists_url":"https://api.github.com/users/jaked122/gists{/gist_id}","starred_url":"https://api.github.com/users/jaked122/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaked122/subscriptions","organizations_url":"https://api.github.com/users/jaked122/orgs","repos_url":"https://api.github.com/users/jaked122/repos","events_url":"https://api.github.com/users/jaked122/events{/privacy}","received_events_url":"https://api.github.com/users/jaked122/received_events","type":"User","site_admin":false},"repo":{"id":39900833,"name":"Cataclysm-DDA","full_name":"jaked122/Cataclysm-DDA","owner":{"login":"jaked122","id":334061,"avatar_url":"https://avatars.githubusercontent.com/u/334061?v=3","gravatar_id":"","url":"https://api.github.com/users/jaked122","html_url":"https://github.com/jaked122","followers_url":"https://api.github.com/users/jaked122/followers","following_url":"https://api.github.com/users/jaked122/following{/other_user}","gists_url":"https://api.github.com/users/jaked122/gists{/gist_id}","starred_url":"https://api.github.com/users/jaked122/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaked122/subscriptions","organizations_url":"https://api.github.com/users/jaked122/orgs","repos_url":"https://api.github.com/users/jaked122/repos","events_url":"https://api.github.com/users/jaked122/events{/privacy}","received_events_url":"https://api.github.com/users/jaked122/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jaked122/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":true,"url":"https://api.github.com/repos/jaked122/Cataclysm-DDA","forks_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/releases{/id}","deployments_url":"https://api.github.com/repos/jaked122/Cataclysm-DDA/deployments","created_at":"2015-07-29T15:22:24Z","updated_at":"2016-05-12T15:25:30Z","pushed_at":"2016-10-09T15:44:35Z","git_url":"git://github.com/jaked122/Cataclysm-DDA.git","ssh_url":"git@github.com:jaked122/Cataclysm-DDA.git","clone_url":"https://github.com/jaked122/Cataclysm-DDA.git","svn_url":"https://github.com/jaked122/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":806821,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"CleverRaven:master","ref":"master","sha":"4b775d07e68017eaecf5da8b6bda2326989435e1","user":{"login":"CleverRaven","id":4367009,"avatar_url":"https://avatars.githubusercontent.com/u/4367009?v=3","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"repo":{"id":5973855,"name":"Cataclysm-DDA","full_name":"CleverRaven/Cataclysm-DDA","owner":{"login":"CleverRaven","id":4367009,"avatar_url":"https://avatars.githubusercontent.com/u/4367009?v=3","gravatar_id":"","url":"https://api.github.com/users/CleverRaven","html_url":"https://github.com/CleverRaven","followers_url":"https://api.github.com/users/CleverRaven/followers","following_url":"https://api.github.com/users/CleverRaven/following{/other_user}","gists_url":"https://api.github.com/users/CleverRaven/gists{/gist_id}","starred_url":"https://api.github.com/users/CleverRaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CleverRaven/subscriptions","organizations_url":"https://api.github.com/users/CleverRaven/orgs","repos_url":"https://api.github.com/users/CleverRaven/repos","events_url":"https://api.github.com/users/CleverRaven/events{/privacy}","received_events_url":"https://api.github.com/users/CleverRaven/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CleverRaven/Cataclysm-DDA","description":"Cataclysm - Dark Days Ahead. A fork/variant of Cataclysm Roguelike by Whales.","fork":false,"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","forks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/forks","keys_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/teams","hooks_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/hooks","issue_events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/events{/number}","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/events","assignees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/assignees{/user}","branches_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/branches{/branch}","tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/tags","blobs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/{sha}","languages_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/languages","stargazers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/stargazers","contributors_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contributors","subscribers_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscribers","subscription_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/subscription","commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/contents/{+path}","compare_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/merges","archive_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/downloads","issues_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues{/number}","pulls_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls{/number}","milestones_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/milestones{/number}","notifications_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/labels{/name}","releases_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/releases{/id}","deployments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/deployments","created_at":"2012-09-26T22:57:43Z","updated_at":"2016-10-10T08:58:29Z","pushed_at":"2016-10-10T12:25:04Z","git_url":"git://github.com/CleverRaven/Cataclysm-DDA.git","ssh_url":"git@github.com:CleverRaven/Cataclysm-DDA.git","clone_url":"https://github.com/CleverRaven/Cataclysm-DDA.git","svn_url":"https://github.com/CleverRaven/Cataclysm-DDA","homepage":"http://en.cataclysmdda.com/","size":1083872,"stargazers_count":1101,"watchers_count":1101,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":970,"mirror_url":null,"open_issues_count":1260,"forks":970,"open_issues":1260,"watchers":1101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696"},"html":{"href":"https://github.com/CleverRaven/Cataclysm-DDA/pull/18696"},"issue":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/18696"},"comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/18696/comments"},"review_comments":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696/comments"},"review_comment":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/18696/commits"},"statuses":{"href":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/statuses/c4d451cd864c61382d614745f0594b82c4d7f5a9"}}}}
{"actor":{"display_login":"mugling"}}