(query, page=1, fields=None, reverse=False, sortedby=[], limit=None)
return final, indexed
Utility functions to search whoosh index, collect results and closes
Utility functions to search whoosh index, collect results and closes
Utility functions to search whoosh index collect results and closes
def perform_search(query, page=1, fields=None, reverse=False, sortedby=[], limit=None):
    """
    Utility functions to search whoosh index, collect results and closes
    """

    limit = limit or settings.SEARCH_LIMIT

    indexed = whoosh_search(query=query, fields=fields, page=page, reverse=reverse, sortedby=sortedby, limit=limit)

    # Highlight the whoosh results.
    copier = lambda r: copy_hits(r, highlight=True)

    final = list(map(copier, indexed))

    indexed.results.searcher.close()

    return final, indexed
def perform_search ( query , page = 1 , fields = None , reverse = False , sortedby = [ ] , limit = None ) : limit = limit or settings . SEARCH_LIMIT indexed = whoosh_search ( query = query , fields = fields , page = page , reverse = reverse , sortedby = sortedby , limit = limit ) # Highlight the whoosh results. copier = lambda r : copy_hits ( r , highlight = True ) final = list ( map ( copier , indexed ) ) indexed . results . searcher . close ( ) return final , indexed