Query count -1 returns all content

Enonic version: 6.5.4
OS: OSX

I’m looking for a way to return all content in a query. I tried count -1, and it seems to work.
This is not documented though. I would like to know if this is a feature or a “feature” that will disappear in the future.

Documentation for reference:
http://repo.enonic.com/public/com/enonic/xp/docs/6.5.4/docs-6.5.4-libdoc.zip!/module-lib_xp_content.html#.query

1 Like

Well, its what we use internally to flag fetch everything. I think it will be safe to use, any changes will be added to backward compatibility-list.

Its could of course a bit sketchy to return everything, but if you know that you will never get a million entries you should be ok. A safer approach will be to first send a query with count 0, get the total from the result and then use that total as count if its within a sensible limit, else page.

3 Likes