<?php
// Get the minimum and maximum indexed values for the posts in the current query on the page
// for a specific number-based facet like a Number Range facet
global $wpdb;
$facet_name = 'my_facet_name'; // replace with name of your facet
$post_ids = FWP()->unfiltered_post_ids;
$sql = "
SELECT MIN(facet_value + 0) AS `min`, MAX(facet_display_value + 0) AS `max` FROM {$wpdb->prefix}facetwp_index
WHERE facet_name = '{$facet_name}' AND facet_display_value != '' AND post_id IN (' . implode( ',', $post_ids ) . ')';";
$row = $wpdb->get_row( $sql );
$range_min = (float) $row->min;
$range_max = (float) $row->max;