MB-11060:  fix up matching logic

Change-Id: I2af68ae17ebbadf46e257a345557de4f2be9efb1
Reviewed-on: http://review.couchbase.org/41837
Reviewed-by: Philip Labee <philip@couchbase.com>
Tested-by: Philip Labee <philip@couchbase.com>