code: def course_discovery_search(search_term=None, size=20, from_=0, field_dictionary=None):
      
      # We'll ignore the course-enrollemnt informaiton in field and filter
      # dictionary, and use our own logic upon enrollment dates for these
      use_search_fields = ["org"]
      (search_fields, _, exclude_dictionary) = SearchFilterGenerator.generate_field_filters()
      use_field_dictionary = {}
      use_field_dictionary.update({field: search_fields[field] for field in search_fields if field in use_search_fields})
      if field_dictionary:
          use_field_dictionary.update(field_dictionary)
      if not getattr(settings, "SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING", False):
          use_field_dictionary["enrollment_start"] = DateRange(None, datetime.utcnow())
  
      searcher = SearchEngine.get_search_engine(getattr(settings, "COURSEWARE_INDEX_NAME", "courseware_index"))
      if not searcher:
          raise NoSearchEngineError("No search engine specified in settings.SEARCH_ENGINE")
  
      results = searcher.search(
          query_string=search_term,
          doc_type="course_info",
          size=size,
          from_=from_,
          # only show when enrollment start IS provided and is before now
          field_dictionary=use_field_dictionary,
          # show if no enrollment end is provided and has not yet been reached
          filter_dictionary={"enrollment_end": DateRange(datetime.utcnow(), None)},
          exclude_dictionary=exclude_dictionary,
          facet_terms=course_discovery_facets(),
      )
  
      return results
docs: Course Discovery activities against the search engine index of course details