public function __construct($query)
 {
     parent::__construct($query);
     $sphinx_config = SphinxSearch_Config::getInstance();
     $documents_config = $sphinx_config->getDocumentsAsArray();
     $field_weights = array();
     foreach ($documents_config as $document_name => $document_properties) {
         foreach ($document_properties["elements"] as $field_name => $field_config) {
             if (array_key_exists("weight", $field_config) && intval($field_config["weight"]) > 0) {
                 $field_weights[$field_name] = intval($field_config["weight"]);
             }
         }
     }
     if (sizeof($field_weights) > 0) {
         $this->SphinxClient->setFieldWeights($field_weights);
     }
 }
 public function __construct($query, $class_name)
 {
     parent::__construct($query);
     $class_name = strtolower($class_name);
     $this->class_name = $class_name;
     $sphinx_config = SphinxSearch_Config::getInstance();
     $class_config = $sphinx_config->getClassesAsArray();
     // The configuration
     $field_weights = array();
     foreach ($class_config[$this->class_name] as $field_name => $field_config) {
         if (array_key_exists("weight", $field_config)) {
             $field_weights[$field_name] = $field_config["weight"];
         }
     }
     if (sizeof($field_weights) > 0) {
         $this->SphinxClient->setFieldWeights($field_weights);
     }
 }