Prez logoPrez

Result Counting

Results are counted in the following way:

Results are counted in the following way:

Scenario: There are 132 total items.

LISTING_COUNT_LIMIT = 100


Configuration Options

LISTING_COUNT_ON_DEMAND

Controls when count queries are executed for listing endpoints. This provides performance optimization by allowing clients to explicitly request counts only when needed.

  • Default: false (for backwards compatibility)
  • Future versions: May default to true

When LISTING_COUNT_ON_DEMAND=false (default):

  • Counts are automatically included in RDF listing responses (up to LISTING_COUNT_LIMIT)
  • This is the current/legacy behaviour

When LISTING_COUNT_ON_DEMAND=true:

  • Counts are NOT included in regular RDF listing responses
  • To get the count, clients must pass ?resultType=hits
  • When resultType=hits is passed, ONLY the count is returned (no items/data)
  • This matches the behaviour already implemented for OGC Features endpoints
  • Provides finer control for frontends over when expensive count queries are performed

Note: GeoJSON responses always follow the hits-only pattern (counts only with ?resultType=hits) regardless of this setting.

Behaviour Matrix

MediaTypeLISTING_COUNT_ON_DEMANDRequest TypeResponse Contains
Annotated RDF (e.g., text/anot+turtle)false (default)Normal listingItems + Count
Non-annotated RDF (e.g., text/turtle)false (default)Normal listingItems only (no count*)
RDF (annotated or non-annotated)false (default)?resultType=hitsCount only (no items)
RDF (annotated or non-annotated)trueNormal listingItems only (no count)
RDF (annotated or non-annotated)true?resultType=hitsCount only (no items)
GeoJSONfalse or trueNormal listingFeatures only (no numberMatched**)
GeoJSONfalse or true?resultType=hitsnumberMatched only (no features)

*Counts are annotations, so non-annotated mediatypes never include counts in normal listings (only with ?resultType=hits).

**numberMatched may be inferred on the first page if the number of features returned is less than the page limit, but no count query is executed.


Future Changes: In a future major release, the LISTING_COUNT_ON_DEMAND setting will be removed and the behaviour will default to the current LISTING_COUNT_ON_DEMAND=true behaviour (counts only returned when explicitly requested via ?resultType=hits).


PagePage SizeStart ItemEnd ItemTotal Count Displayed
120120>100
2202140>100
52081100>100
620101120>120
720121132132

Search Endpoints (SEARCH_USES_LISTING_COUNT_LIMIT = false)

Count query not run — uses page size + 1 fetch logic to determine if more results exist.

PagePage SizeStart ItemEnd ItemTotal Count Displayed
125126>25
2252651>50
525101126>125
625126132132

Search Endpoints (SEARCH_USES_LISTING_COUNT_LIMIT = true)

Count query is run. The same LISTING_COUNT_LIMIT is enforced.

PagePage SizeStart ItemEnd ItemTotal Count Displayed
120121>100
3204161>100
52081101>100
620101121>120
720121132132