code: def perform_search(
          search_term,
          user=None,
          size=10,
          from_=0,
          course_id=None):
      
      # field_, filter_ and exclude_dictionary(s) can be overridden by calling application
      # field_dictionary includes course if course_id provided
      (field_dictionary, filter_dictionary, exclude_dictionary) = SearchFilterGenerator.generate_field_filters(
          user=user,
          course_id=course_id
      )
  
      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_string(
          search_term,
          field_dictionary=field_dictionary,
          filter_dictionary=filter_dictionary,
          exclude_dictionary=exclude_dictionary,
          size=size,
          from_=from_,
          doc_type="courseware_content",
      )
  
      # post-process the result
      for result in results["results"]:
          result["data"] = SearchResultProcessor.process_result(result["data"], search_term, user)
  
      results["access_denied_count"] = len([r for r in results["results"] if r["data"] is None])
      results["results"] = [r for r in results["results"] if r["data"] is not None]
  
      return results
docs: Call the search engine with the appropriate parameters