Пример #1
0
 function build(Search_Query_Order $order)
 {
     $component = '_score';
     $field = $order->getField();
     if ($field !== Search_Query_Order::FIELD_SCORE) {
         if ($order->getMode() == Search_Query_Order::MODE_NUMERIC) {
             $component = array("_script" => array("script" => "doc['{$field}'].value * 1", "type" => "number", "order" => $order->getOrder()));
         } else {
             $component = array($field => $order->getOrder());
         }
     }
     return array("sort" => array($component));
 }
Пример #2
0
 function build(Search_Query_Order $order)
 {
     $component = '_score';
     $field = $order->getField();
     if ($field !== Search_Query_Order::FIELD_SCORE) {
         if ($order->getMode() == Search_Query_Order::MODE_NUMERIC) {
             $component = array("{$field}.nsort" => $order->getOrder());
         } else {
             $component = array("{$field}.sort" => $order->getOrder());
         }
     }
     return array("sort" => array($component));
 }