-
Notifications
You must be signed in to change notification settings - Fork 19
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
No DISTINCT result (with Facet + Order) #15
Comments
Hi, yeah the many-to-many case is tricky and I fear not completely correct yet :-( I welcome any pull requests though. You can fork the repo and have a go at it - the library actually is not that complicated. There are some test and my fixtures actually already contain As a workaround in your app: Have you tries applying distinct to the search result? |
Hi, I've tried the workaround suggested within the controller file: def index This is working fine for the query result, but not for the facets result, because I am only using distinct for @persons and not for @search. I have an error when usinsg distinct for @search. Thanks! |
You can't use it on @search since it's not an active_record object. |
In another example, I have many buildings as a result and I have a facet regarding architects and another regarding types of buildings. When I select an architect that has worked only with one of those buildings, because in that building has worked also another architect, the result is one building (now with the result.distinct), but in the facet of type of buildings I still have house (2) because that building have a relation with 2 architects. Building 1 -> architect 1, architect 2 Incorrect Result: Correct Result should be: Is there any way to solve this issue? Thanks! |
Hi,
I´m trying to use the Forty Facets gem in a ruby on rails application, but testing it I have the following issue:
In a many to many relation, for example, a person does many tasks, and a task is done by many persons, when I select a task (facet) and I also apply order by the person name, the resulting select statement doesn't have a DISTINCT clause, so the query result has the same person repeated many times ( the number of tasks he works on).
Incorrect (without DISTINCT):
Peter -> Task 1, Task 2, Task 3
Peter -> Task 1, Task 2, Task 3
Peter -> Task 1, Task 2, Task 3
Mary -> Task 1, Task 2, Task 3
Mary -> Task 1, Task 2, Task 3
Mary -> Task 1, Task 2, Task 3
Correct:
Peter -> Task 1, Task 2, Task 3
Mary -> Task 1, Task 2, Task 3
I would like to know how can I fix this issue.
Thanks!
The text was updated successfully, but these errors were encountered: