Slight tweak to filtered node expansion logic.

When a filter is active, only expand parent nodes if either a) there is
only one matching parent, or 2) the match actually hit a function
contained in it. This allows the case where the intent of the filter is
to find a particular set of files or subdirectories to be handled more
efficiently.