{"action":"created","issue":{"url":"https://api.github.com/repos/blevesearch/bleve/issues/667","repository_url":"https://api.github.com/repos/blevesearch/bleve","labels_url":"https://api.github.com/repos/blevesearch/bleve/issues/667/labels{/name}","comments_url":"https://api.github.com/repos/blevesearch/bleve/issues/667/comments","events_url":"https://api.github.com/repos/blevesearch/bleve/issues/667/events","html_url":"https://github.com/blevesearch/bleve/issues/667","id":282963544,"number":667,"title":"GopherJS and storing the index as JSON","user":{"login":"ChrisTrenkamp","id":3903329,"avatar_url":"https://avatars0.githubusercontent.com/u/3903329?v=4","gravatar_id":"","url":"https://api.github.com/users/ChrisTrenkamp","html_url":"https://github.com/ChrisTrenkamp","followers_url":"https://api.github.com/users/ChrisTrenkamp/followers","following_url":"https://api.github.com/users/ChrisTrenkamp/following{/other_user}","gists_url":"https://api.github.com/users/ChrisTrenkamp/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisTrenkamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisTrenkamp/subscriptions","organizations_url":"https://api.github.com/users/ChrisTrenkamp/orgs","repos_url":"https://api.github.com/users/ChrisTrenkamp/repos","events_url":"https://api.github.com/users/ChrisTrenkamp/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisTrenkamp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-12-18T17:41:52Z","updated_at":"2018-05-29T17:27:14Z","closed_at":null,"author_association":"NONE","body":"We generate HTML documentation for our customers and need to provide a search solution for the one's that do not have internet access.  Long story short, we're investigating Bleve + GopherJS as a candidate for providing an in-browser, plugin-less search solution.  We've looked at other solutions like Lunr.js, but they were insufficient.\r\n\r\nI pulled Bleve and removed the disk-backed storage interfaces under `github.com/blevesearch/bleve/tree/master/index/store/`, and fixed any compilation errors that tried to reference those packages.  It is now only using the `gtreap` package.\r\n\r\nThen I compiled a simple example:\r\n\r\n```go\r\n//main.go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\r\n\t\"github.com/blevesearch/bleve\"\r\n)\r\n\r\nfunc main() {\r\n\tmessage := struct {\r\n\t\tId   string\r\n\t\tFrom string\r\n\t\tBody string\r\n\t}{\r\n\t\tId:   \"example\",\r\n\t\tFrom: \"marty.schoch@gmail.com\",\r\n\t\tBody: \"bleve indexing is easy\",\r\n\t}\r\n\r\n\tmapping := bleve.NewIndexMapping()\r\n\tindex, err := bleve.NewMemOnly(mapping)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tindex.Index(message.Id, message)\r\n\r\n\tquery := bleve.NewQueryStringQuery(\"bleve\")\r\n\tsearchRequest := bleve.NewSearchRequest(query)\r\n\tfmt.Println(index.Search(searchRequest))\r\n}\r\n```\r\n\r\n```bash\r\n$ go build main.go && ./main\r\n1 matches, showing 1 through 1, took 0s\r\n    1. example (0.125272)\r\n <nil>\r\n\r\n```\r\n\r\nThen threw it at GopherJS:\r\n```bash\r\n$ gopherjs build main.go\r\n\r\n$ ls\r\nmain.go  main.js  main.js.map\r\n\r\n```\r\n\r\nThen created an index.html file:\r\n```html\r\n<!doctype html>\r\n\r\n<html>\r\n    <head>\r\n        <script src=\"main.js\"></script>\r\n    </head>\r\n</html>\r\n```\r\n\r\nOpened up index.html in a browser, and the console displayed:\r\n```\r\nsyscall.go:43 1 matches, showing 1 through 1, took 15ms\r\nsyscall.go:43     1. example (0.125272)\r\nsyscall.go:43  <nil>\r\n```\r\n\r\nIt works!  \r\n\r\nNow, the index needs to backed by some storage, which is what I'm stuck on.  I've tried using `encoding/json` on `mapping.IndexMappingImpl`, but it did not work.  Is there a way to encode `IndexMappingImpl` to some kind of plain string so that it can be read back in as pure in-memory storage?\r\n"},"comment":{"url":"https://api.github.com/repos/blevesearch/bleve/issues/comments/392865672","html_url":"https://github.com/blevesearch/bleve/issues/667#issuecomment-392865672","issue_url":"https://api.github.com/repos/blevesearch/bleve/issues/667","id":392865672,"user":{"login":"mschoch","id":298143,"avatar_url":"https://avatars2.githubusercontent.com/u/298143?v=4","gravatar_id":"","url":"https://api.github.com/users/mschoch","html_url":"https://github.com/mschoch","followers_url":"https://api.github.com/users/mschoch/followers","following_url":"https://api.github.com/users/mschoch/following{/other_user}","gists_url":"https://api.github.com/users/mschoch/gists{/gist_id}","starred_url":"https://api.github.com/users/mschoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mschoch/subscriptions","organizations_url":"https://api.github.com/users/mschoch/orgs","repos_url":"https://api.github.com/users/mschoch/repos","events_url":"https://api.github.com/users/mschoch/events{/privacy}","received_events_url":"https://api.github.com/users/mschoch/received_events","type":"User","site_admin":false},"created_at":"2018-05-29T17:27:14Z","updated_at":"2018-05-29T17:27:14Z","author_association":"MEMBER","body":"Right, so thats what I was trying to get at.  If mmap is a non-starter there is no point in worrying about boltdb or bbolt, scorch relies on mmap as well, so the whole effort is a dead-end."}}
{"actor":{"display_login":"mschoch"}}