-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facets: wrong count on multiple tkeywords filtering #11652
Comments
etj
added a commit
that referenced
this issue
Nov 3, 2023
etj
added a commit
that referenced
this issue
Nov 3, 2023
etj
added a commit
that referenced
this issue
Nov 3, 2023
etj
added a commit
that referenced
this issue
Nov 3, 2023
etj
added a commit
that referenced
this issue
Nov 3, 2023
12 tasks
giohappy
pushed a commit
that referenced
this issue
Nov 6, 2023
…11655) * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - tkeywords * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - category * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - region * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - keywords
giohappy
pushed a commit
that referenced
this issue
Nov 6, 2023
…11655) * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - tkeywords * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - category * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - region * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - keywords
giohappy
added a commit
that referenced
this issue
Nov 6, 2023
* thesaurus topics should only return its own keys (#11644) * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering (#11655) * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - tkeywords * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - category * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - region * [Fixes #11652] Facets: wrong count on multiple tkeywords filtering - keywords --------- Co-authored-by: Emanuele Tajariol <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This problem was verified both for Thesauris keywords, and free text keywords.
The SQL queries that are generated when pre-filtering these facets contain repeated
INNER JOINs
which causes a (cartesian) multiplicative effect on the returnedcount
s per item.It looks like the filters and annotations added by the
Provider.get_facet_items()
to the queryset are causing the issue. The problem is clearly visible in the following video, where counts double when multiple keys are selected.Here below three examples for Tehsauris Keywords.
Ex.1 - Facet without prefiltering query params.
http://localhost:8000/api/v2/facets/3-2-4-1-gemet-inspire-themes-rdf?page=0&pageSize=20
Only one
INNER JOIN
withresource_base
Output:
Ex. 2: Facet with pre-filtering, single keyword
http://localhost:8000/api/v2/facets/3-2-4-1-gemet-inspire-themes-rdf?filter{tkeywords}=16&page=0&pageSize=20
Multiple INNER JOINs are generated.
Result is still ok, because we have only one the cartesian multiplication with keyword 16:
Ex. 3: Facet with pre-filtering, multiple keywords
http://localhost:8000/api/v2/facets/3-2-4-1-gemet-inspire-themes-rdf?filter{tkeywords}=16&filter{tkeywords}=14&include_topics=true&key=16&key=14
Result is wrong, because of cartesian multiplication.
The effect accumulates if additional keywords are added to the prefiltering, as it can be seen in the example below (custom GeoNode)
The text was updated successfully, but these errors were encountered: