Skip to content

Limit not only result pages, but also their meta data values to a certain maximum

Contributed by via Discord

Limit meta data to a maximal amount

Basic

LIMIT data command

If you want to limit your set of result pages, you can use LIMIT for this. See the documentation. This page concentrates on the question of how to limit meta data fields, i.e. outlinks, you get back for a page result.

Need a unused character

For the following code to work, you need to declare a UTF-8 character that is not used in your meta data value. Otherwise, you'll end up with broken data.

TABLE split(join(file.outlinks, "�"),"�",3) As "Outlinks (first 3)"
FROM "30 Dataview Resources"

Variants

Only join and split if length is greater 3

This way you won't end up with empty bullet points in files with no outlinks

TABLE choice(length(file.outlinks) <= 3, file.outlinks, split(join(file.outlinks, "�"),"�",3)) As "Outlinks (first 3)"
FROM "30 Dataview Resources"

Do not rely on a unused character

For the method above to work, you need to settle down on a character that is absolutely not in use for the value you want to limit. Alternatively, you can use the following approach - this is safer, but gets more cumbersome if you want a high limit.

TABLE choice(length(file.outlinks) <= 3, file.outlinks, list(file.outlinks[0], file.outlinks[1], file.outlinks[2])) As "Outlinks (first 3)"
FROM "30 Dataview Resources"
LIMIT 5