dbpedia / dbpedia-lookup

A generic entity retrieval service for linked data. Contains presets to replicate the DBpedia Lookup service.
Apache License 2.0
43 stars 13 forks source link

Is it possible to get the number of results that will be returned by a certain query? #12

Open sergejsrk opened 1 year ago

sergejsrk commented 1 year ago

Hello!

Let us say that I want to find all Cities. To do it I run the following query: https://lookup.dbpedia.org/api/search?typeNameRequired=true&query=City

This query returns only 100 results. Then I can add max results parameter with some approximate value to the original query and run the query again: https://lookup.dbpedia.org/api/search?typeNameRequired=true&query=City&maxResults=200

I can see that num of returned results is equal to maxResults value. Then I can run one more query with the value of maxResults increased.

So this way I certainly can find the num of results in the response.

But I was wondering if maybe there is another way to do it? Maybe something similar to getting count and then iterating with limit and offset ...

Thanks in advance!

holycrab13 commented 11 months ago

I added this as a feature on the current refactor branch which will replace the main branch soon. Once that is done, I will update the dbpedia lookup with this.

Usage will be &maxResults=0 which will then return no documents but a count of the results instead.