Cubus Arts Blog

/ typo3
Andreas Philippi

Truncate typo3 indexed search tables

Andreas Philippi

Huge table index_rel never stops growing

On one of our webservers we have a lot of typo3-based sites. Some of them make use of the indexedsearch extension, which uses some database tables to store the indexed data. These tables can grow really huge .

Bad performance for search queries

The table index_rel grows very fast, having over 6.000.000 entries for some typo3 installations. Even a simple search takes over 30 seconds to complete. I searched for an elegant solution with very little success.

Our current solution: periodical brute force

Here is a brute force solution: a ruby-script that finds all databases that have a index_rel-table and truncates all indexed search tables if they reach a given size. The tables will be automatically refilled every time a page is accessed.

The script truncates the “cache tables” also, the “indexed search tables” will not be rebuild by public requests if only the cache for a given page is returned by a request.

If you want to refill the search instantly index can write a script the crawls the site using wget —spider or something similar.

The script

We call this via cron once a week – every friday night

Andreas Philippi

Typo3 TMENU_LAYERS generates endless recursion loop

Andreas Philippi

What happens?

You have a typo3-template which uses TMENU_LAYERS. You may notice that you’ll get “too much recursion” javascript-errors on all browsers.

microtime is not enough :)

This errors happens because of a unique-ID-generating-function uses microtime. On some machines the microtime-based function does not provide unique IDs.

Under certain conditions, when using TMENU_LAYERS the layers containing the navigation items get non-unique IDs.

We noticed this error after migrating several sites in a virtualized environment on a very fast machine.

our solution

To correct this error we used the php-function uniqid to give us unique ids.

We proceeded this way:

  • locate the file /typo3/sysext/cms/tslib/media/scripts/tmenu_layers.php
  • search for the string: substr(md5(microtime()),0,6);
  • replace the string using: str_replace(‘.’,‘’,uniqid(‘’,true));

We also filed a bug