In upcomming 4.53 release (see latest snapshots at Google Code) the Limit command has been extended. Now you can specify a SQL-query returning all possible pairs of limit value and corresponding url.rec_id. E.g.:
Limit prm:strcrc32 "SELECT label, rec_id FROM labels" pgsql://u:p@localhost/site/
Third parameter (DBAddr) is an optional, you can use it to specify a connection to other SQL-database differ to the one used for search engine, and which is used to select limit values from. prm - is the limit name and the name of CGI-parameter is used to specify a value to limit on. strcrc32 - is the type of limit, in this particular case it's a string on which the hash32 value is calculated and used as a key.
Instead of strcrc32 it can possible to use the follofing types:
hex8str - hex string or base-26 string, similar those used for the category limit. In this case a nested limit is created.
int - an integer (4-bytes).
You can use reduced verian of Limit command in search template search.htm or in searchd.conf configuration file: