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).
OK, that's simple enough. Seems like we might want to accumulate errors in these phases, but I guess that's a question for another day.