Support

Account

Home Forums Add-ons Repeater Field Search engine with repeater field and wp_query Reply To: Search engine with repeater field and wp_query

  • Thinking about it, it might be possible, but it could cause a performance issue.

    If you have a limited number of rows in the DB for this. In my example let’s say that there are no more than 2 rows in the repeater

    
    $meta_query = array(
      'relation' => 'OR',
      // first potential row
      array(
        'relation' => 'AND',
        array(
          'key' => 'prix_0_typo_prog',
          'value' => $_POST['typologie'],
          'compare' => '=',
        ),
        array(
          'key' => 'prix_0_prix_prog',
          'value' => $prix,
          'type' => 'NUMERIC',
          'compare' => '<='
        )
      ),
      // second potential row
      array(
        'relation' => 'AND',
        array(
          'key' => 'prix_1_typo_prog',
          'value' => $_POST['typologie'],
          'compare' => '=',
        ),
        array(
          'key' => 'prix_1_prix_prog',
          'value' => $prix,
          'type' => 'NUMERIC',
          'compare' => '<='
        )
      ),
      // continue for every potential row
    );
    

    But if you have too many rows and too many nested queries it will eventually time out.