{"action":"reopened","issue":{"url":"https://api.github.com/repos/basho/riak/issues/618","repository_url":"https://api.github.com/repos/basho/riak","labels_url":"https://api.github.com/repos/basho/riak/issues/618/labels{/name}","comments_url":"https://api.github.com/repos/basho/riak/issues/618/comments","events_url":"https://api.github.com/repos/basho/riak/issues/618/events","html_url":"https://github.com/basho/riak/issues/618","id":47627895,"number":618,"title":"Map Reduce with Search input not working (2.0+) [JIRA: RIAK-1605]","user":{"login":"pigmej","id":496754,"avatar_url":"https://avatars.githubusercontent.com/u/496754?v=3","gravatar_id":"","url":"https://api.github.com/users/pigmej","html_url":"https://github.com/pigmej","followers_url":"https://api.github.com/users/pigmej/followers","following_url":"https://api.github.com/users/pigmej/following{/other_user}","gists_url":"https://api.github.com/users/pigmej/gists{/gist_id}","starred_url":"https://api.github.com/users/pigmej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pigmej/subscriptions","organizations_url":"https://api.github.com/users/pigmej/orgs","repos_url":"https://api.github.com/users/pigmej/repos","events_url":"https://api.github.com/users/pigmej/events{/privacy}","received_events_url":"https://api.github.com/users/pigmej/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/basho/riak/labels/JIRA:%20Closed","name":"JIRA: Closed","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-11-03T18:38:24Z","updated_at":"2016-03-01T16:30:17Z","closed_at":null,"body":"Consider:\r\n```\r\n#!/bin/sh\r\n\r\ncurl -XPUT $RIAK_HOST/search/index/$BUCKET\r\n\r\ncurl -XPUT $RIAK_HOST/search/index/$BUCKET \\\r\n     -H 'Content-Type: application/json' \\\r\n     -d '{\"schema\":\"_yz_default\"}'\r\nsleep 12\r\n\r\n\r\ncurl -XPUT \"$RIAK_HOST/buckets/$BUCKET/props\" \\\r\n     -H'content-type:application/json' \\\r\n     -d\"{\\\"props\\\":{\\\"search_index\\\":\\\"$BUCKET\\\"}}\"\r\nsleep 3\r\n\r\n\r\ncurl -XPUT \"$RIAK_HOST/buckets/$BUCKET/keys/liono\" \\\r\n     -H'content-type:application/json' \\\r\n     -d'{\"name_s\":\"Lion-o\", \"age_i\":30, \"leader_b\":true}'\r\n\r\ncurl -XPUT \"$RIAK_HOST/buckets/$BUCKET/keys/cheetara\" \\\r\n     -H'content-type:application/json' \\\r\n     -d'{\"name_s\":\"Cheetara\", \"age_i\":28, \"leader_b\":false}'\r\n\r\ncurl -XPUT \"$RIAK_HOST/buckets/$BUCKET/keys/snarf\" \\\r\n     -H'content-type:application/json' \\\r\n     -d'{\"name_s\":\"Snarf\", \"age_i\":43}'\r\n\r\ncurl -XPUT \"$RIAK_HOST/buckets/$BUCKET/keys/panthro\" \\\r\n     -H'content-type:application/json' \\\r\n     -d'{\"name_s\":\"Panthro\", \"age_i\":36}'\r\n\r\n\r\necho \"Simple query\"\r\ncurl \"$RIAK_HOST/search/query/$BUCKET?wt=json&q=name_s:Lion*\"\r\ncurl \"$RIAK_HOST/buckets/$BUCKET/keys/liono\"\r\necho \"\"\r\n\r\n\r\necho \"\"\r\necho \"MR Search\"\r\ncurl -XPOST $RIAK_HOST/mapred \\\r\n  -H 'Content-Type: application/json' \\\r\n  -d \"{\\\"inputs\\\":{\\\"module\\\":\\\"yokozuna\\\",\\\"function\\\":\\\"mapred_search\\\",\\\"arg\\\":[\\\"$BUCKET\\\",\\\"name_s:Lion*\\\"]},\\\"query\\\":[{\\\"map\\\":{\\\"language\\\":\\\"javascript\\\",\\\"keep\\\":false,\\\"source\\\":\\\"function(v) { return [1]; }\\\"}},{\\\"reduce\\\":{\\\"language\\\":\\\"javascript\\\",\\\"keep\\\":true,\\\"name\\\":\\\"Riak.reduceSum\\\"}}]}\"\r\necho \"\"\r\n```\r\n\r\nRun it like ```BUCKET=test11 RIAK_HOST=http://{host}:{port} bash riak.sh```.\r\n1. It will create new search index with ```yz_default``` schema.\r\n2. It will then add some data (from search documentation page in fact)\r\n3. It will run normal Search query and it will return data then.\r\n4. It will run the same input query as a input in map/reduce (also from documentation page), with `[1]` and sum as map/reduce phases.\r\n\r\nIn 4th step it will for me always return `[0]`.\r\n\r\nBucket props: \r\n```\r\n{\"props\":{\"allow_mult\":false,\"basic_quorum\":false,\"big_vclock\":50,\"chash_keyfun\":{\"mod\":\"riak_core_util\",\"fun\":\"chash_std_keyfun\"},\"dvv_enabled\":false,\"dw\":\"quorum\",\"last_write_wins\":false,\"linkfun\":{\"mod\":\"riak_kv_wm_link_walker\",\"fun\":\"mapreduce_linkfun\"},\"n_val\":1,\"name\":\"test11\",\"notfound_ok\":true,\"old_vclock\":86400,\"postcommit\":[],\"pr\":0,\"precommit\":[],\"pw\":0,\"r\":\"quorum\",\"rw\":\"quorum\",\"search_index\":\"test11\",\"small_vclock\":50,\"w\":\"quorum\",\"young_vclock\":20}}%\r\n```\r\n\r\n// I tested also ``bitcask`` storage backend, and no difference."}}