Exemplo n.º 1
0
 function ResetQueryFlag()
 {
     $this->_query_flags = sphSetBit(0, 6, true);
     // default idf=tfidf_normalized
     $this->_predictedtime = 0;
 }
Exemplo n.º 2
0
 function SetQueryFlag($flag_name, $flag_value)
 {
     $known_names = array("reverse_scan", "sort_method", "max_predicted_time", "boolean_simplify", "idf");
     $flags = array("reverse_scan" => array(0, 1), "sort_method" => array("pq", "kbuffer"), "max_predicted_time" => array(0), "boolean_simplify" => array(true, false), "idf" => array("normalized", "plain"));
     assert(isset($flag_name, $known_names));
     assert(in_array($flag_value, $flags[$flag_name], true) || $flag_name == "max_predicted_time" && is_int($flag_value) && $flag_value >= 0);
     if ($flag_name == "reverse_scan") {
         $this->_query_flags = sphSetBit($this->_query_flags, 0, $flag_value == 1);
     }
     if ($flag_name == "sort_method") {
         $this->_query_flags = sphSetBit($this->_query_flags, 1, $flag_value == "kbuffer");
     }
     if ($flag_name == "max_predicted_time") {
         $this->_query_flags = sphSetBit($this->_query_flags, 2, $flag_value > 0);
         $this->_predictedtime = (int) $flag_value;
     }
     if ($flag_name == "boolean_simplify") {
         $this->_query_flags = sphSetBit($this->_query_flags, 3, $flag_value);
     }
     if ($flag_name == "idf") {
         $this->_query_flags = sphSetBit($this->_query_flags, 4, $flag_value == "plain");
     }
 }