0
0

Merge pull request #528 from bfontaine/syntax

README: Use go syntax highlighting
This commit is contained in:
Marty Schoch 2017-02-04 09:52:58 -05:00 committed by GitHub
commit 50c43bfef6

View File

@ -33,29 +33,33 @@ Discuss usage and development of bleve in the [google group](https://groups.goog
## Indexing ## Indexing
message := struct{ ```go
Id string message := struct{
From string Id string
Body string From string
}{ Body string
Id: "example", }{
From: "marty.schoch@gmail.com", Id: "example",
Body: "bleve indexing is easy", From: "marty.schoch@gmail.com",
} Body: "bleve indexing is easy",
}
mapping := bleve.NewIndexMapping() mapping := bleve.NewIndexMapping()
index, err := bleve.New("example.bleve", mapping) index, err := bleve.New("example.bleve", mapping)
if err != nil { if err != nil {
panic(err) panic(err)
} }
index.Index(message.Id, message) index.Index(message.Id, message)
```
## Querying ## Querying
index, _ := bleve.Open("example.bleve") ```go
query := bleve.NewQueryStringQuery("bleve") index, _ := bleve.Open("example.bleve")
searchRequest := bleve.NewSearchRequest(query) query := bleve.NewQueryStringQuery("bleve")
searchResult, _ := index.Search(searchRequest) searchRequest := bleve.NewSearchRequest(query)
searchResult, _ := index.Search(searchRequest)
```
## License ## License