'Perform a search of the Beatport catalogue.
:param query:           Query string
:param release_type:    Type of releases to search for, can be
\'release\' or \'track\'
:param details:         Retrieve additional information about the
search results. Currently this will fetch
the tracklist for releases and do nothing for
tracks
:returns:               Search results
:rtype:                 generator that yields
py:class:`BeatportRelease` or
:py:class:`BeatportTrack`'

def search(self, query, release_type='release', details=True):

    response = self._get('catalog/3/search', query=query, perPage=5, facets=['fieldType:{0}'.format(release_type)])
    for item in response:
        if (release_type == 'release'):
            if details:
                release = self.get_release(item['id'])
            else:
                release = BeatportRelease(item)
            (yield release)
        elif (release_type == 'track'):
            (yield BeatportTrack(item))
