Serializing a struct and its methods for later reuse
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13.2k
- Forks
- 573
- PR merge metrics
- No merged PRs in 30d
Description
Let's say you have a static web site and you want to provide a search via a pre-populated search index. So you write a little program to read in the content of your site and create some search indices. We can use Bleve and utilize its in-memory store since it doesn't rely on os-specific functionality like mmap.
package main
import "github.com/blevesearch/bleve"
func createIndex(idx bleve.Index) {
//Some code for walking the website and populating the index...
}
func main() {
index, _ := bleve.NewMemOnly(bleve.NewIndexMapping())
createIndex(index)
// The Bleve store is now populated with your sites search indices...
// ... now what?
}
Given the above pseudocode, being ran with GopherJS, to create the search indices, is there a way to serialize it to a file so it can be pulled in by the website? The above link shows ways to use GopherJS to build an index using GopherJS, but I can't figure out how to use GopherJS to generate a pre-built search index.
Any help will be appreciated.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked Bleve backstory and the NewMemOnly example first. Investigate whether a populated in-memory Bleve index created through GopherJS can be serialized to a file and loaded by the website; done means establishing a supported approach or clearly documenting that none exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- compilers, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100