fix duplicate objects returned in search

A search can potentially return the same key more than once based on the
various query criteria that was met.  In order to avoid returning the
same objects multiple times, these are now trimmed.  This still has the
potential to run the application out of memory and must be used with
care.