在我的应用程序中,我想通过邮政编码集成距离搜索。
$result['zipcode'] = $this->Locations->find('all', array('conditions' => array('plz' => $param)));
if (count($city['Plz']) > 1)
$result['city'] = $this->Locations->find('all', array('conditions' => array('ort' => $city['Stadt']['name'], 'plz !=' => $city['Plz']['zipcode'])));
$this->Locations->virtualFields['distance'] = 'ACOS(SIN(RADIANS(Locations.lat)) * SIN(RADIANS('.$city["Stadt"]["lat"].')) + COS(RADIANS(Locations.lat)) * COS(RADIANS('.$city["Stadt"]["lat"].')) * COS(RADIANS(Locations.lng) - RADIANS('.$city["Stadt"]["lng"].')) ) * 6380';
$result['near'] = $this->Locations->find('all', array(
'conditions' => array(
'plz !=' => $param,
'ort !=' => $city['Stadt']['name'],
),
'order' => 'distance ASC'
));
我想按邮政编码、城市(如果城市有很多邮政编码)和附近的顺序显示结果,所以我这样做了。但现在我想通过蛋糕分页对这个结果进行分页。是否有可能使这些查询得到一个即
$this->Locations->find('all', array('conditions' => array(
'order' => 'RESULTS BY ZIPCODE, RESULTS BY CITY, RESULTS BY MISSMATCH ORDERED BY DISTANCE'
)));
你将如何解决这个问题?
M。