upsidedown.UpdateWithAnalysis() advanced helper method
upsidedown.UpdateWithAnalysis() advanced helper method

This commit refactors the UpsideDownCouch.Update(doc) method with a
helper method, UpdateWithAnalysis(), in order to allow advanced apps
to skip the analysis queue and back-index lookup steps of upsidedown's
single-doc Update().

The use-case motivation details...

couchbase server is integrating the N1QL query engine with its
bleve-powered full-text search engine, and may need to check that a
document matches a search during N1QL's predicate filtering phase.
For example...

  SELECT * FROM `beer-sample` as b
  WHERE SEARCH(b, "desc:good");

  SELECT * FROM [ {"desc": "the beer is good"} ] AS b
  WHERE SEARCH(b, "desc:good");

The above SEARCH()'es default to using a default, dynamic mapping.  If
an appropriate FTS index exists, it can be used to speed up the query.

In the case of a non-existent or non-covering FTS index, there might
be many JSON docs that need to be predicate-filtered by the N1QL
engine, where predicate-filtering is processed 1 doc at a time.

This is supported by creating a reused, upsidedown index using moss
configured in memory-only mode.  Each doc to be examined is a) indexed
(so the index's doc-count will only ever reach a max of 1) and b) the
upsidedown index is searched to see if the doc is a hit.

In upsidedown's Update(doc), the usual handoff to the analysis
goroutines was dominating the pprof graphs.  So, this commit enables a
performance optimization where couchbase can now avoid goroutine
switching via UpdateWithAnalysis().

Some microbenchmark results from github.com/couchbase/n1fty...

  BenchmarkMossWithoutOptimizations-8       20000 61246 ns/op 26021 B/op 386 allocs/op
  BenchmarkMossWithOptimizeReset-8          30000 55692 ns/op 20863 B/op 323 allocs/op
  BenchmarkMossWithOptimizeResetAndUpdate-8 50000 32241 ns/op 16924 B/op 230 allocs/op

The "Reset" is another, recent moss-specific optimization (ea630c),
for a fuller before-vs-after picture.

blevesearch/bleve,blevesearch/bleve