'With type=SEARCH, returns a MediaWikiArticle for the given query (case-sensitive).
With type=ALL, returns a list of results.
Each result.title is the title of an article that contains the given query.'

def search(self, query, type=SEARCH, start=1, count=10, sort=RELEVANCY, size=None, cached=True, **kwargs):

    if (type not in (SEARCH, ALL, '*')):
        raise SearchEngineTypeError
    if (type == SEARCH):
        return self.article(query, cached=cached, **kwargs)
    if ((not query) or (start < 1) or (count < 1)):
        return Results(self._url, query, type)
    url = URL(self._url, method=GET, query={'action': 'query', 'list': 'search', 'srsearch': query, 'sroffset': ((start - 1) * count), 'srlimit': min(count, 100), 'srprop': 'snippet', 'format': 'json'})
    kwargs.setdefault('unicode', True)
    kwargs.setdefault('throttle', self.throttle)
    data = url.download(cached=cached, **kwargs)
    data = json.loads(data)
    data = data.get('query', {})
    results = Results(self._url, query, type)
    results.total = int(data.get('searchinfo', {}).get('totalhits', 0))
    for x in data.get('search', []):
        u = ('http://%s/wiki/%s' % (URL(self._url).domain, x.get('title').replace('    ', '_')))
        r = Result(url=u)
        r.id = self.format(x.get('title'))
        r.title = self.format(x.get('title'))
        r.text = self.format(plaintext(x.get('snippet')))
        results.append(r)
    return results
