/**
  * Extracts the configuration stored in the DB and turns it into a Solr-compliant XML string.
  * Stores the result string in the local property $configurationXML
  *
  * @see $configurationXML
  * @return boolean true if the generation run correctly, false otherwise.
  *
  */
 protected static function generateConfiguration()
 {
     $db = eZDB::instance();
     $def = self::definition();
     $query = "SELECT DISTINCT search_query FROM " . $def['name'];
     $limit = 50;
     $offset = 0;
     $solr = new eZSolr();
     $xml = new SimpleXMLElement(self::XML_SKELETON);
     self::$configurationXML = $xml->asXML();
     while (true) {
         // fetch distinct search queries
         $rows = $db->arrayQuery($query, array('limit' => $limit, 'offset' => $offset));
         if (empty($rows)) {
             break;
         }
         // For each query string, generate the corresponding bloc in elevate.xml
         // Looks like this :
         //
         // <query text="foo bar">
         //    <doc id="1" />
         //    <doc id="2" />
         //    <doc id="3" />
         // </query>
         $xml = new SimpleXMLElement(self::$configurationXML);
         foreach ($rows as $row) {
             $searchQuery = $xml->addChild('query');
             $searchQuery->addAttribute('text', $row['search_query']);
             $results = self::fetchObjectsForQueryString($row['search_query']);
             foreach ($results as $languageCode => $objects) {
                 foreach ($objects as $object) {
                     if ($languageCode === self::WILDCARD) {
                         $currentVersion = $object->currentVersion();
                         foreach ($currentVersion->translationList(false, false) as $lang) {
                             $guid = $solr->guid($object, $lang);
                             $doc = $searchQuery->addChild('doc');
                             $doc->addAttribute('id', $guid);
                         }
                     } else {
                         $guid = $solr->guid($object, $languageCode);
                         $doc = $searchQuery->addChild('doc');
                         $doc->addAttribute('id', $guid);
                     }
                 }
             }
         }
         $offset += $limit;
         self::$configurationXML = $xml->asXML();
     }
     return true;
 }