original_string: protected function get_missing_docs($missingdocs) {
          if (empty($missingdocs)) {
              return array();
          }
  
          $docids = array_keys($missingdocs);
  
          // Build a custom query that will get all the missing documents.
          $query = new \SolrQuery();
          $this->set_query($query, '*');
          $this->add_fields($query);
          $query->setRows(count($docids));
          $query->addFilterQuery('{!cache=false}id:(' . implode(' OR ', $docids) . ')');
  
          $response = $this->get_query_response($query);
          // We know the missing docs have already been checked for access, so don't recheck.
          $results = $this->process_response($response, 0, true);
  
          $out = array();
          foreach ($results as $result) {
              $resultid = $result->get('id');
              if (!isset($missingdocs[$resultid])) {
                  // We got a result we didn't expect. Skip it.
                  continue;
              }
              // Attach the files.
              foreach ($missingdocs[$resultid] as $filedoc) {
                  $result->add_stored_file($filedoc);
              }
              $out[$resultid] = $result;
          }
  
          return $out;
      }
code: protected function get_missing_docs($missingdocs) {
          if (empty($missingdocs)) {
              return array();
          }
  
          $docids = array_keys($missingdocs);
  
          // Build a custom query that will get all the missing documents.
          $query = new \SolrQuery();
          $this->set_query($query, '*');
          $this->add_fields($query);
          $query->setRows(count($docids));
          $query->addFilterQuery('{!cache=false}id:(' . implode(' OR ', $docids) . ')');
  
          $response = $this->get_query_response($query);
          // We know the missing docs have already been checked for access, so don't recheck.
          $results = $this->process_response($response, 0, true);
  
          $out = array();
          foreach ($results as $result) {
              $resultid = $result->get('id');
              if (!isset($missingdocs[$resultid])) {
                  // We got a result we didn't expect. Skip it.
                  continue;
              }
              // Attach the files.
              foreach ($missingdocs[$resultid] as $filedoc) {
                  $result->add_stored_file($filedoc);
              }
              $out[$resultid] = $result;
          }
  
          return $out;
      }
code_tokens: protected function get_missing_docs ( $ missingdocs ) { if ( empty ( $ missingdocs ) ) { return array ( ) ; } $ docids = array_keys ( $ missingdocs ) ; // Build a custom query that will get all the missing documents. $ query = new \ SolrQuery ( ) ; $ this -> set_query ( $ query , '*' ) ; $ this -> add_fields ( $ query ) ; $ query -> setRows ( count ( $ docids ) ) ; $ query -> addFilterQuery ( '{!cache=false}id:(' . implode ( ' OR ' , $ docids ) . ')' ) ; $ response = $ this -> get_query_response ( $ query ) ; // We know the missing docs have already been checked for access, so don't recheck. $ results = $ this -> process_response ( $ response , 0 , true ) ; $ out = array ( ) ; foreach ( $ results as $ result ) { $ resultid = $ result -> get ( 'id' ) ; if ( ! isset ( $ missingdocs [ $ resultid ] ) ) { // We got a result we didn't expect. Skip it. continue ; } // Attach the files. foreach ( $ missingdocs [ $ resultid ] as $ filedoc ) { $ result -> add_stored_file ( $ filedoc ) ; } $ out [ $ resultid ] = $ result ; } return $ out ; }
docstring: Retreive any missing main documents and attach provided files.
  
  The missingdocs array should be an array, indexed by document id, of main documents we need to retrieve. The value
  associated to the key should be an array of stored_files or stored file ids to attach to the result document.
  
  Return array also indexed by document id.
  
  @param array() $missingdocs An array, indexed by document id, with arrays of files/ids to attach.
  @return document[]
docstring_tokens: Retreive any missing main documents and attach provided files .