Limit

Name

Limit -- describes a fast limit

indexer.conf search.htm

Synopsis

Limit {name} {sql}

This command describes an SQL query returning a list of URL IDs and associates it with the given name. The query is executed during execution of indexer -Eblob, indexer -Erewriteurl or indexer -Erewritelimits and its results are stored in the database in a compact way, which allows to fetch the limit during search time very effeciently.

Note: Use the "fl" search.cgi parameter to load a previously created fast limit at search time.

Note: Since version 3.2.39, it's also possible to specify the "fl" parameter in the "DBAddr" search.htm command, to set different limits for the databases listed in the template.

The fast limits work much faster than the section limits, which use the "sl" search.cgi parameter described in the Section called Search parameters in Chapter 8. Unlike the "sl" limits, the fast limits are suitable for huge databases and can use very complex WHERE condition, typically on the "url" or "urlinfo" mnoGoSearch tables, but can also use joins with external tables.

The fast limits work only with the databases supporting DBMode=blob (see the Section called Storage mode - blob in Chapter 5) and reuse the "bdict" SQL table, however they are available for DBMode=single and DBMode=multi as well.

Note: If you use DBMode=single or DBMode=multi, then execute indexer -Erewritelimits to create or recreate the fast limits after indexing.

Note: If you use DBMode=blob then the fast limits are recreated automatically during execution of indexer -Eblob or indexer -Erewriteurl, however you can still use indexer -Erewritelimits for quick rewrite of the fast limits without touching other data.

Since 3.2.39, it is also possible to specify the "Limit" commands directly in search.htm, without having to cache the desired limits using "indexer -Eblob". It can be useful for those limits whose SQL queries work very efficiently and return a very small number of documents.

Examples


Limit mod  "SELECT rec_id FROM url WHERE url LIKE '%/mod/%'"
Limit html "SELECT url_id FROM urlinfo WHERE sname='Content-Type' AND sval='text/html'"
      

See also

the Section called Search parameters in Chapter 8, the Section called Storage mode - blob in Chapter 5, DBAddr.