def _document_suggestions(searcher, text, locale, product, max_results):
    if max_results <= 0:
        return []

    search_filter = es_utils.F(
        model='wiki_document',
        document_category__in=settings.SEARCH_DEFAULT_CATEGORIES,
        document_locale=locale,
        document_is_archived=False)

    if product:
        search_filter &= es_utils.F(product=product)

    documents = []
    searcher = _query(searcher, DocumentMappingType, search_filter, text, locale)

    doc_ids = [result['id'] for result in searcher[:max_results]]

    documents = [
        DocumentDetailSerializer(instance=doc).data
        for doc in Document.objects.filter(id__in=doc_ids)
    ]

    return documents
dataset/ETHPy150Open mozilla/kitsune/kitsune/search/api.py/_document_suggestions/original