{"action":"created","issue":{"url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/102","repository_url":"https://api.github.com/repos/arboliveira/liferay-portal","labels_url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/102/comments","events_url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/102/events","html_url":"https://github.com/arboliveira/liferay-portal/pull/102","id":144552619,"number":102,"title":"[TECHNICAL-SUPPORT] LPS-64269 Fix Custom date range search (Elasticsearch)","user":{"login":"lipusz","id":1556706,"avatar_url":"https://avatars.githubusercontent.com/u/1556706?v=3","gravatar_id":"","url":"https://api.github.com/users/lipusz","html_url":"https://github.com/lipusz","followers_url":"https://api.github.com/users/lipusz/followers","following_url":"https://api.github.com/users/lipusz/following{/other_user}","gists_url":"https://api.github.com/users/lipusz/gists{/gist_id}","starred_url":"https://api.github.com/users/lipusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipusz/subscriptions","organizations_url":"https://api.github.com/users/lipusz/orgs","repos_url":"https://api.github.com/users/lipusz/repos","events_url":"https://api.github.com/users/lipusz/events{/privacy}","received_events_url":"https://api.github.com/users/lipusz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-03-30T11:16:32Z","updated_at":"2016-04-06T08:04:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/arboliveira/liferay-portal/pulls/102","html_url":"https://github.com/arboliveira/liferay-portal/pull/102","diff_url":"https://github.com/arboliveira/liferay-portal/pull/102.diff","patch_url":"https://github.com/arboliveira/liferay-portal/pull/102.patch"},"body":"https://issues.liferay.com/browse/LPS-64269\r\n\r\nHi André,\r\n\r\nThe custom range \"modified\" has to be added to the query otherwise\r\n- facet collector may return null\r\n- count will always be zero for Custom Ranges\r\n\r\n**Issue 1: Custom date range search fails with NPE on Solr**\r\nIt was (partially) fixed in https://issues.liferay.com/browse/LPS-48279 in the past, but as a result of the refactoring in LPS-49586, the related logic was not migrated so it's reproducible again.\r\n\r\n**Issue 2: Facet count always shows zero for \"Custom Range\" facet term (ES, Solr)**\r\nThe same logic has to be added to ES' Modified/RangeFacetProcessor.\r\n\r\nYou may notice the difference between the fixes for Solr & ES. For ES I've found that we need to use to same rangeBuilder instance, otherwise (e.g. creating a new one) the query will look like this:\r\n\r\n````json\r\n{\r\n  \"aggregations\" : {\r\n    \"userName\" : {\r\n      \"terms\" : {\r\n        \"field\" : \"userName\"\r\n      }\r\n    },\r\n    \"modified\" : {\r\n      \"range\" : {\r\n        \"field\" : \"modified\",\r\n        \"ranges\" : [ {\r\n          \"from\" : \"20160329170000\",\r\n          \"to\" : \"20160329190000\"\r\n        }, {\r\n          \"from\" : \"20160328180000\",\r\n          \"to\" : \"20160329190000\"\r\n        }, {\r\n          \"from\" : \"20160322180000\",\r\n          \"to\" : \"20160329190000\"\r\n        }, {\r\n          \"from\" : \"20160229180000\",\r\n          \"to\" : \"20160329190000\"\r\n        }, {\r\n          \"from\" : \"20150329180000\",\r\n          \"to\" : \"20160329190000\"\r\n        } ]\r\n      }\r\n    },\r\n    \"modified\" : {\r\n      \"range\" : {\r\n        \"field\" : \"modified\",\r\n        \"ranges\" : [ {\r\n          \"from\" : \"20160329000000\",\r\n          \"to\" : \"20160329235959\"\r\n        } ]\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nwhich is wrong, since 2 aggregations with the same \"name\" are present.\r\n````\r\n\r\nIf you think commits @70f1bb823914b34bd1bfe77fc1fea303d9295e1e and @3792a381392624203ecca849c6d1994c3893deb5 add too much overhead, feel free to delete them and keep the other 2 ones (@19d947e33035dbfba63e6a874054204e30c2f9e3, @5ac06db067b228b97e799375da0e234b64db5fae) for ES.\r\n\r\nCheers,\r\nTibor"},"comment":{"url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/comments/206200941","html_url":"https://github.com/arboliveira/liferay-portal/pull/102#issuecomment-206200941","issue_url":"https://api.github.com/repos/arboliveira/liferay-portal/issues/102","id":206200941,"user":{"login":"lipusz","id":1556706,"avatar_url":"https://avatars.githubusercontent.com/u/1556706?v=3","gravatar_id":"","url":"https://api.github.com/users/lipusz","html_url":"https://github.com/lipusz","followers_url":"https://api.github.com/users/lipusz/followers","following_url":"https://api.github.com/users/lipusz/following{/other_user}","gists_url":"https://api.github.com/users/lipusz/gists{/gist_id}","starred_url":"https://api.github.com/users/lipusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipusz/subscriptions","organizations_url":"https://api.github.com/users/lipusz/orgs","repos_url":"https://api.github.com/users/lipusz/repos","events_url":"https://api.github.com/users/lipusz/events{/privacy}","received_events_url":"https://api.github.com/users/lipusz/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T08:04:59Z","updated_at":"2016-04-06T08:04:59Z","body":"Rebased"}}