original_string: public function execute_query($filters, $accessinfo, $limit = 0) {
          global $USER;
  
          if (empty($limit)) {
              $limit = \core_search\manager::MAX_RESULTS;
          }
  
          // If there is any problem we trigger the exception as soon as possible.
          $client = $this->get_search_client();
  
          // Create the query object.
          $query = $this->create_user_query($filters, $accessinfo);
  
          // If the query cannot have results, return none.
          if (!$query) {
              return [];
          }
  
          // We expect good match rates, so for our first get, we will get a small number of records.
          // This significantly speeds solr response time for first few pages.
          $query->setRows(min($limit * 3, static::QUERY_SIZE));
          $response = $this->get_query_response($query);
  
          // Get count data out of the response, and reset our counters.
          list($included, $found) = $this->get_response_counts($response);
          $this->totalenginedocs = $found;
          $this->processeddocs = 0;
          $this->skippeddocs = 0;
          if ($included == 0 || $this->totalenginedocs == 0) {
              // No results.
              return array();
          }
  
          // Get valid documents out of the response.
          $results = $this->process_response($response, $limit);
  
          // We have processed all the docs in the response at this point.
          $this->processeddocs += $included;
  
          // If we haven't reached the limit, and there are more docs left in Solr, lets keep trying.
          while (count($results) < $limit && ($this->totalenginedocs - $this->processeddocs) > 0) {
              // Offset the start of the query, and since we are making another call, get more per call.
              $query->setStart($this->processeddocs);
              $query->setRows(static::QUERY_SIZE);
  
              $response = $this->get_query_response($query);
              list($included, $found) = $this->get_response_counts($response);
              if ($included == 0 || $found == 0) {
                  // No new results were found. Found being empty would be weird, so we will just return.
                  return $results;
              }
              $this->totalenginedocs = $found;
  
              // Get the new response docs, limiting to remaining we need, then add it to the end of the results array.
              $newdocs = $this->process_response($response, $limit - count($results));
              $results = array_merge($results, $newdocs);
  
              // Add to our processed docs count.
              $this->processeddocs += $included;
          }
  
          return $results;
      }
code: public function execute_query($filters, $accessinfo, $limit = 0) {
          global $USER;
  
          if (empty($limit)) {
              $limit = \core_search\manager::MAX_RESULTS;
          }
  
          // If there is any problem we trigger the exception as soon as possible.
          $client = $this->get_search_client();
  
          // Create the query object.
          $query = $this->create_user_query($filters, $accessinfo);
  
          // If the query cannot have results, return none.
          if (!$query) {
              return [];
          }
  
          // We expect good match rates, so for our first get, we will get a small number of records.
          // This significantly speeds solr response time for first few pages.
          $query->setRows(min($limit * 3, static::QUERY_SIZE));
          $response = $this->get_query_response($query);
  
          // Get count data out of the response, and reset our counters.
          list($included, $found) = $this->get_response_counts($response);
          $this->totalenginedocs = $found;
          $this->processeddocs = 0;
          $this->skippeddocs = 0;
          if ($included == 0 || $this->totalenginedocs == 0) {
              // No results.
              return array();
          }
  
          // Get valid documents out of the response.
          $results = $this->process_response($response, $limit);
  
          // We have processed all the docs in the response at this point.
          $this->processeddocs += $included;
  
          // If we haven't reached the limit, and there are more docs left in Solr, lets keep trying.
          while (count($results) < $limit && ($this->totalenginedocs - $this->processeddocs) > 0) {
              // Offset the start of the query, and since we are making another call, get more per call.
              $query->setStart($this->processeddocs);
              $query->setRows(static::QUERY_SIZE);
  
              $response = $this->get_query_response($query);
              list($included, $found) = $this->get_response_counts($response);
              if ($included == 0 || $found == 0) {
                  // No new results were found. Found being empty would be weird, so we will just return.
                  return $results;
              }
              $this->totalenginedocs = $found;
  
              // Get the new response docs, limiting to remaining we need, then add it to the end of the results array.
              $newdocs = $this->process_response($response, $limit - count($results));
              $results = array_merge($results, $newdocs);
  
              // Add to our processed docs count.
              $this->processeddocs += $included;
          }
  
          return $results;
      }
code_tokens: public function execute_query ( $ filters , $ accessinfo , $ limit = 0 ) { global $ USER ; if ( empty ( $ limit ) ) { $ limit = \ core_search \ manager :: MAX_RESULTS ; } // If there is any problem we trigger the exception as soon as possible. $ client = $ this -> get_search_client ( ) ; // Create the query object. $ query = $ this -> create_user_query ( $ filters , $ accessinfo ) ; // If the query cannot have results, return none. if ( ! $ query ) { return [ ] ; } // We expect good match rates, so for our first get, we will get a small number of records. // This significantly speeds solr response time for first few pages. $ query -> setRows ( min ( $ limit * 3 , static :: QUERY_SIZE ) ) ; $ response = $ this -> get_query_response ( $ query ) ; // Get count data out of the response, and reset our counters. list ( $ included , $ found ) = $ this -> get_response_counts ( $ response ) ; $ this -> totalenginedocs = $ found ; $ this -> processeddocs = 0 ; $ this -> skippeddocs = 0 ; if ( $ included == 0 || $ this -> totalenginedocs == 0 ) { // No results. return array ( ) ; } // Get valid documents out of the response. $ results = $ this -> process_response ( $ response , $ limit ) ; // We have processed all the docs in the response at this point. $ this -> processeddocs += $ included ; // If we haven't reached the limit, and there are more docs left in Solr, lets keep trying. while ( count ( $ results ) < $ limit && ( $ this -> totalenginedocs - $ this -> processeddocs ) > 0 ) { // Offset the start of the query, and since we are making another call, get more per call. $ query -> setStart ( $ this -> processeddocs ) ; $ query -> setRows ( static :: QUERY_SIZE ) ; $ response = $ this -> get_query_response ( $ query ) ; list ( $ included , $ found ) = $ this -> get_response_counts ( $ response ) ; if ( $ included == 0 || $ found == 0 ) { // No new results were found. Found being empty would be weird, so we will just return. return $ results ; } $ this -> totalenginedocs = $ found ; // Get the new response docs, limiting to remaining we need, then add it to the end of the results array. $ newdocs = $ this -> process_response ( $ response , $ limit - count ( $ results ) ) ; $ results = array_merge ( $ results , $ newdocs ) ; // Add to our processed docs count. $ this -> processeddocs += $ included ; } return $ results ; }
docstring: Prepares a Solr query, applies filters and executes it returning its results.
  
  @throws \core_search\engine_exception
  @param  \stdClass $filters Containing query and filters.
  @param  \stdClass $accessinfo Information about areas user can access.
  @param  int       $limit The maximum number of results to return.
  @return \core_search\document[] Results or false if no results
docstring_tokens: Prepares a Solr query applies filters and executes it returning its results .