search: dedup results in union operation
Created by: rvantonder
Addresses #12481.
The prior union merge operation sometimes added duplicate file matches due to bad logic in the inner for loop. It was hard to notice this duplication because, results would either contain the correct union operation for matched lines, or we would see results of a successful, but short-circuited result set. I added an integration test that detects the regression for a small result set.
This PR gets rid of the double for loop and instead accumulates the results set of the one subexpression in a lookup, and then iterates over the results of the other subexpression and uses the lookup to check for duplicates. We use a similar lookup for the intersection code, except here, for union, mutually exclusive results for each set are added to the final set as well.