{"action":"created","issue":{"url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/139","labels_url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/139/comments","events_url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/139/events","html_url":"https://github.com/OpenConceptLab/oclapi/issues/139","id":95262373,"number":139,"title":"Facets are incorrect for org sources results","user":{"login":"paynejd","id":1189689,"avatar_url":"https://avatars.githubusercontent.com/u/1189689?v=3","gravatar_id":"","url":"https://api.github.com/users/paynejd","html_url":"https://github.com/paynejd","followers_url":"https://api.github.com/users/paynejd/followers","following_url":"https://api.github.com/users/paynejd/following{/other_user}","gists_url":"https://api.github.com/users/paynejd/gists{/gist_id}","starred_url":"https://api.github.com/users/paynejd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paynejd/subscriptions","organizations_url":"https://api.github.com/users/paynejd/orgs","repos_url":"https://api.github.com/users/paynejd/repos","events_url":"https://api.github.com/users/paynejd/events{/privacy}","received_events_url":"https://api.github.com/users/paynejd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenConceptLab/oclapi/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/OpenConceptLab/oclapi/labels/high-priority","name":"high-priority","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-15T18:39:44Z","updated_at":"2015-07-21T01:33:42Z","closed_at":"2015-07-21T01:33:42Z","body":"/orgs/CIEL/ owns 2 sources (see `GET /orgs/CIEL/sources/`)\r\n\r\nThe results are correct, but when includeFacets is set to true, the returned facets seem to reference all or most of the sources. It appears that a different set of criteria were applied to the search results as were applied to the facets."},"comment":{"url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/comments/123124576","html_url":"https://github.com/OpenConceptLab/oclapi/issues/139#issuecomment-123124576","issue_url":"https://api.github.com/repos/OpenConceptLab/oclapi/issues/139","id":123124576,"user":{"login":"MisterNando","id":1670990,"avatar_url":"https://avatars.githubusercontent.com/u/1670990?v=3","gravatar_id":"","url":"https://api.github.com/users/MisterNando","html_url":"https://github.com/MisterNando","followers_url":"https://api.github.com/users/MisterNando/followers","following_url":"https://api.github.com/users/MisterNando/following{/other_user}","gists_url":"https://api.github.com/users/MisterNando/gists{/gist_id}","starred_url":"https://api.github.com/users/MisterNando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MisterNando/subscriptions","organizations_url":"https://api.github.com/users/MisterNando/orgs","repos_url":"https://api.github.com/users/MisterNando/repos","events_url":"https://api.github.com/users/MisterNando/events{/privacy}","received_events_url":"https://api.github.com/users/MisterNando/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T01:33:42Z","updated_at":"2015-07-21T01:33:42Z","body":"Well, the details vary across the different endpoints, but the path through the call stack typically looks like this:\r\n\r\n1. \"List\" view implements ```get``` (or extends ListAPIView, which implements ```get```) which responds to ```GET``` requests.\r\n2. ```get``` calls ```list``` (which is often inherited from ```ListWithHeadersMixin```, which supplies the headers).\r\n3. ```list``` calls ```filter_queryset``` on the result of ```get_queryset```.\r\n4. ```get_queryset``` applies filters against the Mongo collection.  Most often, this method is inherited from (or extends) one of the base class implementations defined here: https://github.com/OpenConceptLab/oclapi/blob/master/django-nonrel/ocl/oclapi/views.py\r\n5. ```filter_queryset``` applies filters against the Solr index.  Again, its implementation varies across endpoints.  (Each view specifies a ```filter_backends``` array, which is essentially a search path over classes that implement ```filter_queryset```.)  Some of the filter backends will calculate the intersection between the Mongo Queryset and the Solr SearchQueryset (children of ```HaystackSearchFilter```), and others (children of ```SimpleHaystackSearchFilter```) will simply return the SearchQueryset (when the intersect operation is redundant)."}}