def _documents_for(locale, topics=None, products=None):
 documents = cache.get(_documents_for_cache_key(locale, topics, products))
 if documents:
  statsd.incr('wiki.facets.documents_for.cache')
  return documents
 try:
  documents = _es_documents_for(locale, topics, products)
  cache.add(_documents_for_cache_key(locale, topics, products), documents)
  statsd.incr('wiki.facets.documents_for.es')
 except TransportError:
  documents = _db_documents_for(locale, topics, products)
  statsd.incr('wiki.facets.documents_for.db')
 return documents

def _documents_for ( locale , topics = None , products = None ) : documents = cache . get ( _documents_for_cache_key ( locale , topics , products ) ) if documents : statsd . incr ( 'wiki.facets.documents_for.cache' ) return documents try : documents = _es_documents_for ( locale , topics , products ) cache . add ( _documents_for_cache_key ( locale , topics , products ) , documents ) statsd . incr ( 'wiki.facets.documents_for.es' ) except TransportError : documents = _db_documents_for ( locale , topics , products ) statsd . incr ( 'wiki.facets.documents_for.db' ) return documents
returns a list of articles that apply to passed in topics and products .