Records in the Database: 5.
The Problem: 这段代码搜索5条记录需要很长时间,之后挂断,没有成功的结果。如果我更改\'relation\' => \'OR\'
到\'relation\' => \'AND\'
这是可行的,但这不是我在这个场景中想要的。
Is everything okay in my code?
<?php
$args = array(
\'post_type\' => \'shipping-schedules\',
\'posts_per_page\' => 5,
\'post_status\' => \'publish\',
\'paged\' => $paged,
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'schedules_port\',
\'value\' => $sfrom,
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'schedules_port\',
\'value\' => $sto,
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'schedules_vessel\',
\'value\' => $svessel,
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'schedules_voyage\',
\'value\' => $svoyage,
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'schedules_arrival\',
\'value\' => $sdate_arrival,
\'compare\' => \'>=\',
\'type\' => \'NUMERIC\'
),
array(
\'key\' => \'schedules_departure\',
\'value\' => $sdate_departure,
\'compare\' => \'<=\',
\'type\' => \'NUMERIC\'
)
)
);
?>