From 72955126fa988aceeb18ce434f0cee7b1ae94127 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 13 Nov 2023 13:22:12 +0300 Subject: Return distinct results after a dataset search. * gn3/api/metadata.py (search_datasets): Return distinct search results. Signed-off-by: Munyoki Kilyungi --- gn3/api/metadata.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3/api') diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py index 60be66e..6623508 100644 --- a/gn3/api/metadata.py +++ b/gn3/api/metadata.py @@ -280,7 +280,7 @@ CONSTRUCT { ] } WHERE { { - SELECT ?dataset ?label ?inbredSetName ?datasetType ?title WHERE { + SELECT DISTINCT ?dataset ?label ?inbredSetName ?datasetType ?title WHERE { ?dataset rdf:type dcat:Dataset ; rdfs:label ?label ; ?datasetPredicate ?datasetObject ; @@ -301,7 +301,7 @@ CONSTRUCT { } { - SELECT (COUNT(*)/$limit+1 AS ?totalCount) WHERE { + SELECT (COUNT(DISTINCT ?dataset)/$limit+1 AS ?pages) (COUNT(DISTINCT ?dataset) AS ?hits) WHERE { ?dataset rdf:type dcat:Dataset ; ?p ?o . ?o bif:contains "'$term'" . -- cgit v1.2.3