{"action":"created","issue":{"url":"https://api.github.com/repos/inonit/drf-haystack/issues/62","repository_url":"https://api.github.com/repos/inonit/drf-haystack","labels_url":"https://api.github.com/repos/inonit/drf-haystack/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/inonit/drf-haystack/issues/62/comments","events_url":"https://api.github.com/repos/inonit/drf-haystack/issues/62/events","html_url":"https://github.com/inonit/drf-haystack/issues/62","id":163079424,"number":62,"title":"Add support for query facets","user":{"login":"clintonb","id":910510,"avatar_url":"https://avatars.githubusercontent.com/u/910510?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonb","html_url":"https://github.com/clintonb","followers_url":"https://api.github.com/users/clintonb/followers","following_url":"https://api.github.com/users/clintonb/following{/other_user}","gists_url":"https://api.github.com/users/clintonb/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonb/subscriptions","organizations_url":"https://api.github.com/users/clintonb/orgs","repos_url":"https://api.github.com/users/clintonb/repos","events_url":"https://api.github.com/users/clintonb/events{/privacy}","received_events_url":"https://api.github.com/users/clintonb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-30T04:37:48Z","updated_at":"2016-06-30T13:36:25Z","closed_at":null,"body":"Add support for customizable query facets."},"comment":{"url":"https://api.github.com/repos/inonit/drf-haystack/issues/comments/229659907","html_url":"https://github.com/inonit/drf-haystack/issues/62#issuecomment-229659907","issue_url":"https://api.github.com/repos/inonit/drf-haystack/issues/62","id":229659907,"user":{"login":"rhblind","id":1574295,"avatar_url":"https://avatars.githubusercontent.com/u/1574295?v=3","gravatar_id":"","url":"https://api.github.com/users/rhblind","html_url":"https://github.com/rhblind","followers_url":"https://api.github.com/users/rhblind/followers","following_url":"https://api.github.com/users/rhblind/following{/other_user}","gists_url":"https://api.github.com/users/rhblind/gists{/gist_id}","starred_url":"https://api.github.com/users/rhblind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhblind/subscriptions","organizations_url":"https://api.github.com/users/rhblind/orgs","repos_url":"https://api.github.com/users/rhblind/repos","events_url":"https://api.github.com/users/rhblind/events{/privacy}","received_events_url":"https://api.github.com/users/rhblind/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T13:36:25Z","updated_at":"2016-06-30T13:36:25Z","body":"Yes, as you've discovered I've kind of just ignored this. But it should definitely be supported.\r\n\r\nI have not quite decided on how to do the implementation, but it should be implemented in a way that feels natural concerning the other faceting options (by utilising the `field_options` dictionary on the `HaystackFacetSerializer`).\r\n\r\nIt would probably also be useful to be able to override the declared `query_facets` in the query string, as we can with the existing options.\r\n\r\nSince we already declare the `field_options` as `{<field_name>: {\"option\": value}}` one solution could be to look for a nested list/tuple construction using ie. `query` as key in order to indicate that this is a field query which should be passed on to the search backend.\r\n\r\nEx:\r\n```python\r\nfield_options = {\r\n    \"firstname\": {\"query\": [\"robin*\", \"joh*\"]}\r\n}\r\n```\r\n\r\nNext, when constructing the query in the `FacetQueryBuilder` class, we would check for the `query` identifier and iterate all values from the list applying them something like this:  `SearchQuerySet().query_facet(\"firstname\", \"robin*\").query_facet(\"firstname\", \"joh*\")`\r\n\r\nThis way we can support multiple query facets per field, as well as keeping the API simple and familiar.\r\nThe main drawback is that we're building a little \"weird\" convention.\r\n\r\nAny inputs are appreciated!\r\n"}}
{"actor":{"display_login":"rhblind"}}