Hi,
One of solution method most suitable for this topic was found.
For example I'd like to search for the maximum value and date period in group rows.
I make readonly text field for search condition 'meta_query'.
When post save with get value(min, max for search)
and update_post_meta() in post_save ()action.
A search could be sped up by readonly field for group data searches.
For example save_post action
add_action( 'save_post', 'savepost_update_meta' );
function savepost_update_meta($post_id){
// check post type or category, etc.
if(get_post_type($post_id) !== 'post_type_foo') return;
// get group meta data
$groupRows = rwmb_meta('goup_id', $args = array(), $post_id);
$priceMin = '';
$priceMax = '';
if($groupRows){
foreach($groupRows as $row){
$price = isset($row['field_price']) ? $row['field_price'] : '';
// check value
if(empty($priceMin)){
$priceMin = $price;
}else{
if((int)$price < (int)$priceMin) $priceMin = $price;
}
if((int)$priceMax < (int)$price) $priceMax = $price;
}
// update readonly meta field
update_post_meta($post_id, 'field_readonly_text_min_price', $priceMin);
update_post_meta($post_id, 'field_readonly_text_max_price', $priceMax);
}else{
// delete readonly meta field when nothing group data
delete_post_meta($post_id, 'field_readonly_text_min_price');
delete_post_meta($post_id, 'field_readonly_text_max_price');
}
}
$meta_query[] = array(
'key' => 'field_readonly_text_min_price',
'value' => $searchPrice,
'compare' => '<=',
'type' => 'NUMERIC'
);
Thanks anyway!