Maximum number of facets in Facets List - how tu increase?

Hi, I’m preparing a digital resources web page for one of holocaust museums in Poland and I’d like to make in it a single page including index of all names from proper taksonomy, so I’ve made a page with “Facets List” block. Generally it works good but I’m not able to increase number of facets (names) over 96. Where to find this value to increase? My names index will be much longer than 96, for sure. It’s very important part of projected page, so I’m even ready to make changes in php files and edit it again and again after every update, but I have to make this index. How tu change this damn’d 96 to, for example, 9999?

Hi @Michal_Stanek, welcome to our forum!

Unfortunately that is a fixed value for now. I’m actually going to open an issue because we do have a constant that can be set to change this maximum value for items listings:
define('TAINACAN_API_MAX_ITEMS_PER_PAGE', 96);

But even changing that it should only affect some items listing, not the facets block, for instance. But in any case, there is a good reason for that… facets are a heavy query and ideally should be paginated if you are looking for lots of them. The WordPress database structure is not really well suited for this kind of rough call and setting a value so high as 9999 may even bring down your server. There are alternatives, that can improve overall speed like using an extra database to index stuff such as the ElasticPress plugin, which we’ve been using and its quite efficient.

In any case, you can also build your own Query. It would take som effort, but you could start with something like this:

          $terms = get_terms( array(
              'taxonomy' => 'tnc_tax_7612',
              'orderby' => 'name',
              'order' => 'ASC',
              'hide_empty' => false,
              'number' => ''
          ) );

The 7612 in the taxonomy should be the ID of your taxonomy. Then you could loop it like this:

if ( !empty( $terms ) && !is_wp_error( $terms ) ) { 
     foreach ( $filtered_terms as $term ) {
         $tainacan_term = new \Tainacan\Entities\Term( $term );
          ?>
          <div class="term-header">
              <h2 class="title"><?php echo $tainacan_term->get_name(); ?></h2>
          </div>
         <?php
     }
}
1 curtida

Update: Issue created:

Shouldn’t be hard to implement, we just need to find a breach in our schedule.

1 curtida