generalize Search implementation (Fixes #416)

Implement Search for arbitrary string arguments (not just constant string
patterns). Also implemented Search in JS for use outside filtering.

All query expressions typed as constants are now inlined in the logical plan.

Add additional cases to `WorkflowBuilder.merge` to avoid calling
`toCollectionBuilder`, resulting in dramatically flattened $simpleMaps
and $projects in many cases. We should not be creating any nested temp
objects at this point, unless I missed something. Note: this makes it
much easier to spot redundant projections (projecting the same value
under more than one temp name). We'll want to get rid of these (see #474).
If this (and the next one) should eventually be used, add a FIXME/TODO with an issue reference, otherwise just remove them.