'Returns a list of results from Facebook public status updates for the given query.
- query: string, or Result.id for NEWS and COMMENTS,
- type : SEARCH,
- start: 1,
- count: maximum 100 for SEARCH and NEWS, 1000 for COMMENTS and LIKES.
There is an hourly limit of +-600 queries (actual amount undisclosed).'

def search(self, query, type=SEARCH, start=1, count=10, cached=False, **kwargs):

    if (type not in (SEARCH, NEWS, COMMENTS, LIKES, FRIENDS)):
        raise SearchEngineTypeError
    if (type in (SEARCH, NEWS)):
        max = 100
    if (type in (COMMENTS, LIKES)):
        max = 1000
    if (type in (FRIENDS,)):
        max = 10000
    if ((not query) or (start < 1) or (count < 1)):
        return Results(FACEBOOK, query, SEARCH)
    if isinstance(query, FacebookResult):
        query = query.id
    if (type == SEARCH):
        url = (FACEBOOK + type)
        url = URL(url, method=GET, query={'q': query, 'type': 'post', 'access_token': self.license, 'offset': ((start - 1) * min(count, max)), 'limit': ((start - 0) * min(count, max))})
    if (type in (NEWS, FEED, COMMENTS, LIKES, FRIENDS)):
        url = (((FACEBOOK + (u(query) or 'me').replace(FACEBOOK, '')) + '/') + type.replace('news', 'feed'))
        url = URL(url, method=GET, query={'access_token': self.license, 'offset': ((start - 1) * min(count, max)), 'limit': ((start - 0) * min(count, max))})
    if (type in (SEARCH, NEWS, FEED)):
        url.query['fields'] = ','.join(('id', 'from', 'name', 'story', 'message', 'link', 'picture', 'created_time', 'shares', 'comments.limit(1).summary(true)', 'likes.limit(1).summary(true)'))
    kwargs.setdefault('cached', cached)
    kwargs.setdefault('unicode', True)
    kwargs.setdefault('throttle', self.throttle)
    try:
        data = URL(url).download(**kwargs)
    except HTTP400BadRequest:
        raise HTTP401Authentication
    data = json.loads(data)
    results = Results(FACEBOOK, query, SEARCH)
    results.total = None
    for x in data.get('data', []):
        r = FacebookResult(url=None)
        r.id = self.format(x.get('id'))
        r.url = self.format(x.get('link'))
        r.text = self.format(x.get('story', x.get('message', x.get('name'))))
        r.date = self.format(x.get('created_time'))
        r.votes = self.format((x.get('like_count', x.get('likes', {}).get('summary', {}).get('total_count', 0)) + 0))
        r.shares = self.format(x.get('shares', {}).get('count', 0))
        r.comments = self.format((x.get('comments', {}).get('summary', {}).get('total_count', 0) + 0))
        r.author = (self.format(x.get('from', {}).get('id', '')), self.format(x.get('from', {}).get('name', '')))
        if (type in (LIKES, FRIENDS)):
            r.author = (self.format(x.get('id', '')), self.format(x.get('name', '')))
            r.text = self.format(x.get('name'))
        if (re.match('^http(s?)://www\\.facebook\\.com/photo', r.url) is not None):
            r.url = (x.get('picture', '').replace('_s', '_b') or r.url)
        if (re.match('^http(s?)://www\\.facebook\\.com/', r.url) is not None):
            r.title = r.url.split('/')[(-1)].split('?')[0]
        results.append(r)
    return results
