{"action":"created","issue":{"url":"https://api.github.com/repos/blevesearch/bleve/issues/1021","repository_url":"https://api.github.com/repos/blevesearch/bleve","labels_url":"https://api.github.com/repos/blevesearch/bleve/issues/1021/labels{/name}","comments_url":"https://api.github.com/repos/blevesearch/bleve/issues/1021/comments","events_url":"https://api.github.com/repos/blevesearch/bleve/issues/1021/events","html_url":"https://github.com/blevesearch/bleve/issues/1021","id":369941313,"node_id":"MDU6SXNzdWUzNjk5NDEzMTM=","number":1021,"title":"Boolean field search return wrong results","user":{"login":"aviadl","id":14630210,"node_id":"MDQ6VXNlcjE0NjMwMjEw","avatar_url":"https://avatars3.githubusercontent.com/u/14630210?v=4","gravatar_id":"","url":"https://api.github.com/users/aviadl","html_url":"https://github.com/aviadl","followers_url":"https://api.github.com/users/aviadl/followers","following_url":"https://api.github.com/users/aviadl/following{/other_user}","gists_url":"https://api.github.com/users/aviadl/gists{/gist_id}","starred_url":"https://api.github.com/users/aviadl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviadl/subscriptions","organizations_url":"https://api.github.com/users/aviadl/orgs","repos_url":"https://api.github.com/users/aviadl/repos","events_url":"https://api.github.com/users/aviadl/events{/privacy}","received_events_url":"https://api.github.com/users/aviadl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"abhinavdangeti","id":1863456,"node_id":"MDQ6VXNlcjE4NjM0NTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1863456?v=4","gravatar_id":"","url":"https://api.github.com/users/abhinavdangeti","html_url":"https://github.com/abhinavdangeti","followers_url":"https://api.github.com/users/abhinavdangeti/followers","following_url":"https://api.github.com/users/abhinavdangeti/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdangeti/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdangeti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdangeti/subscriptions","organizations_url":"https://api.github.com/users/abhinavdangeti/orgs","repos_url":"https://api.github.com/users/abhinavdangeti/repos","events_url":"https://api.github.com/users/abhinavdangeti/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdangeti/received_events","type":"User","site_admin":false},"assignees":[{"login":"abhinavdangeti","id":1863456,"node_id":"MDQ6VXNlcjE4NjM0NTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1863456?v=4","gravatar_id":"","url":"https://api.github.com/users/abhinavdangeti","html_url":"https://github.com/abhinavdangeti","followers_url":"https://api.github.com/users/abhinavdangeti/followers","following_url":"https://api.github.com/users/abhinavdangeti/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdangeti/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdangeti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdangeti/subscriptions","organizations_url":"https://api.github.com/users/abhinavdangeti/orgs","repos_url":"https://api.github.com/users/abhinavdangeti/repos","events_url":"https://api.github.com/users/abhinavdangeti/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdangeti/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-10-14T20:39:43Z","updated_at":"2018-10-18T22:14:27Z","closed_at":"2018-10-18T22:13:35Z","author_association":"NONE","body":"Run the following test:\r\n```\r\npackage bleve\r\n\r\nimport (\r\n\t\"github.com/stretchr/testify/assert\"\r\n\t\"testing\"\r\n)\r\n\r\nfunc TestBooleanSearch(t *testing.T) {\r\n\r\n\ttq := NewTermQuery(\"1\")\r\n\ttq.SetField(\"investigationId\")\r\n\t//We are using must not, for cases that the field did not exists at all\r\n\thasRole := NewBoolFieldQuery(true)\r\n\thasRole.SetField(\"hasRole\")\r\n\tnoRole := NewBooleanQuery()\r\n\tnoRole.AddMustNot(hasRole)\r\n\toneRolesOrNoRoles := NewBooleanQuery()\r\n\toneRolesOrNoRoles.AddShould(noRole)\r\n\toneRolesOrNoRoles.SetMinShould(1)\r\n\tq := NewConjunctionQuery(tq, oneRolesOrNoRoles)\r\n\r\n\t//Index contains objects that hasRole == false on other \"investigationId\"\r\n\tidx, err := Open(\"./test_boolean_search\")\r\n\tif err != nil {\r\n\t\tt.Fatal(err)\r\n\t}\r\n\r\n\tsr := NewSearchRequestOptions(q, 100, 0, false)\r\n\tsr.Fields = []string{\"roles\", \"hasRole\"}\r\n\tsr.Highlight = NewHighlight()\r\n\r\n\tres, err := idx.Search(sr)\r\n\tif err != nil {\r\n\t\tt.Fatal(err)\r\n\t}\r\n\tassert.Equal(t, 0, int(res.Total))\r\n}\r\n```\r\n with the database attached\r\n[test_boolean_search.zip](https://github.com/blevesearch/bleve/files/2476825/test_boolean_search.zip)\r\n\r\nIt will fail (search should not return any results\r\nIf you roll back `search/searcher/search_boolean.go` to previous commit (`65fed52d0b5b6cbb8e116a308d76bdf10dd96b52`) test will pass\r\n\r\nIf simplifying the boolean query (removing mustNot and placing `false` instead) test will pass as well"},"comment":{"url":"https://api.github.com/repos/blevesearch/bleve/issues/comments/431182257","html_url":"https://github.com/blevesearch/bleve/issues/1021#issuecomment-431182257","issue_url":"https://api.github.com/repos/blevesearch/bleve/issues/1021","id":431182257,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTE4MjI1Nw==","user":{"login":"abhinavdangeti","id":1863456,"node_id":"MDQ6VXNlcjE4NjM0NTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1863456?v=4","gravatar_id":"","url":"https://api.github.com/users/abhinavdangeti","html_url":"https://github.com/abhinavdangeti","followers_url":"https://api.github.com/users/abhinavdangeti/followers","following_url":"https://api.github.com/users/abhinavdangeti/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdangeti/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdangeti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdangeti/subscriptions","organizations_url":"https://api.github.com/users/abhinavdangeti/orgs","repos_url":"https://api.github.com/users/abhinavdangeti/repos","events_url":"https://api.github.com/users/abhinavdangeti/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdangeti/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T22:14:27Z","updated_at":"2018-10-18T22:14:27Z","author_association":"MEMBER","body":"Thanks @aviadl for the test case!"}}
{"actor":{"display_login":"abhinavdangeti"}}