-
Notifications
You must be signed in to change notification settings - Fork 8
-
Notifications
You must be signed in to change notification settings - Fork 8
Provide mechanism to get info on total number of results #297
Comments
As said in #230 (comment) I would look into using the Sindice Search Vocabulary for providing information on a query and its results with total number of results being one part of this information. |
Bump - when using the API to discover link targets for workflows such as @edoweb's, this is a really important feature. |
+1, we also need this for NWBib. Technically this is no problem at all, the only issue is how to serve it as RDF. How do we make statements about the query? Can we simply add a generic statement like:
Or do we need to include the actual query in some way? |
I would argue that the query itself can be referenced by it's URL, e.g.
Also see #230 (comment) |
The first thing we should do before implementing this is discontinuing support for other RDF serializations than JSON-LD (and RDFa) in query results (as @jschnasse already proposed some time ago). The results of This said, here's my first take on how to provide the search results in JSON-LD:
(This example applies for the ``?format=full |
The first thing you should do is ask if someone uses other RDF serializations. Second of all - if search results are valid JSON-LD, what stops you from providing other serializations?
Yes, this uses RDF-lists, which are not the prettiest thing in the world. But to make the JSON-LD not only implicitly (based on JSON-syntax that is) deliver the proper result order, they would have to be modeled as a list anyways. |
@literarymachine Do you use the RDF serializations for lobid search results? :) |
Yes, I currently use ntriples. |
Implementing the changes suggested by @acka47 would imply an incompatible 2.0 API release, since the basic response structure would be completely different: we'd be returning a JSON object as the top level element, instead of an array. The approach that I started implementing yesterday is to add a new entity for the query itself as the first entity in the response. In JSON-LD, this would look like this:
Removing the RDF search results has the same issue: we'd break API, we can only do this in a 2.0 release. The approach above would e.g. yield this if N-Triples are requested:
|
As interim solution the proposal by @fsteeg would be ok with me. Would this also be ok for you, @literarymachine, for the time being? |
+1 (see #297 (comment)) We should probably discuss any further (and incompatible) modifications of the result format somewhere else. Just a short addition to #297 (comment): marking the
|
Deployed for testing: http://test.lobid.org/resource?name=Typee&format=full&size=1
|
+1 |
Deployed to production, closing: http://lobid.org/resource?name=Typee&format=full&size=1 curl -L --header "Accept: text/plain" "http://lobid.org/resource?name=Typee&size=1" |
Reopening, does not work correctly for RDF+XML:
Has two root elements, should have only one. See possibly similar issue in hbz/oerworldmap. |
Deployed fix to staging (don't add query info on path-style requests for single resources): http://test.lobid.org/resource?name=Typee&format=full&size=1 |
Deployed to production, closing. Opened new issue for RDF+XML results for multiple hits with one root: #463 (independent from the topic of this issue, did already return multiple root elements before total number of results were added). |
Currently, API users don't get any information of the total number of results a specific query yields. This is no problem if the number of hits is < 50 as all results show up in one document. If the number of hits is > 50 one would have to page through all results and add all results together to get to know the total number (which would add unnecessary API load.
Thus, the total number of hits should be delivered by default with with every query response or users should have the possibility to somehow ask for the total number of hits.
The text was updated successfully, but these errors were encountered: