basho/riak_kv — pull request #656 by beerriot (2013-09-06 19:23:40+00:00)
Title: use yokozuna or riak_search for {search, ...} MR inputs

*Note*: this should probably be considered non-merge-able until bucket-types land, since that has the potential for significant conflict, and redefinition of bucket-index mapping for yokozuna. I'm opening the PR now for comment and backup purposes.

There are two ways to use riak_search inputs for MapReduce:
* specify a {modfun, ...} input ({"module":...,"function":...} in json)
* specify a {search, ...} input ({"bucket":...,"query":...} in json)

This patch allows yokozuna to power the second type instead of
riak_search. The value of the "bucket" field is used as the name of the
yokozuna index.

This patch does not convert the modfun version, to keep from surprising
users, and to allow an escape hatch for people that need to use both.

If only one of riak_search or yokozuna is enabled, that system is chosen
to power search MR inputs.

If both are enabled, then the riak_kv's appenv 'mapred_search' must also
be defined as either 'riak_search' or 'yokozuna'. If it is not defined,
or it is defined as something else, and error will be returned from the MR.

If neither is enabled, an error is returned from the MR.

The automatic nature of the switch is intended to keep configuration as
minimal as possible: the extra riak_kv setting is only needed if *both*
riak_search and yokozuna are to be used, *and* the user wants to use the
non-modfun forms. If only one search system is enabled, or only modfun
input forms are used, the correct thing just happens.