bwanders / dokuwiki-strata

Strata - a Semi-Structured Data plugin for Dokuwiki
https://www.dokuwiki.org/plugin:strata
17 stars 8 forks source link

hard limit results #39

Closed dhighet closed 2 years ago

dhighet commented 7 years ago

As noted in #28 pagination seems to be a complicated solution, but is there a way to just hard cap the amount to display? Say I'm just wanting to display the last 10 items added?

bwanders commented 7 years ago

Unfortunately, limiting the number of output results is not possible at the moment.

I agree that this would be a nice to have.

(Implementation note for anyone that wants to pick this up: adding a limtation like this has to be done at the level of the strata_relations_iterator and strata_resource_iterator, found in helper/triples.php. Care must be taken if the limitation is pushed to the SQL level: the resource iterator has special handling for loading all of a resource, and will not function correctly if the output rows are limited since the limit will not take into account the intuitive meaning of limiting a resource query — that is, it won't take into account limiting by resource.)

dhighet commented 7 years ago

Understandable. I've managed a solution that works for me, for now at least.

I'm currently creating entries via Bureaucracy, so with that I'm appending dates to the entries (as @DATE(<datetime>,%%Y-%%m-%%d)@). On my main page, I'm filtering only results to show by month using Date to get the current year/month, with the following lines in my <table>.

?p Created [date]: ?date
?date > {{date> %Y-%m}}

I was surprised it worked!

FosseWay commented 6 years ago

I found #39 because I wanted to display e.g. the 5 most recent events from an event table on the front page of my wiki.

Thank you @bwanders for the guidance above. I don't know if I will have time in the near future to attempt to implement this, but I hope to do it at some point.