parent
3eb63a887b
commit
7a174d7d05
41
README.md
41
README.md
|
@ -1,6 +1,39 @@
|
|||
# bleve
|
||||
# ![bleve](docs/bleve.png) bleve
|
||||
|
||||
modern text indexing in go
|
||||
|
||||
## Features
|
||||
* Index any go data structure (including JSON)
|
||||
* Intelligent defaults backed up by powerful configuration
|
||||
* Supported field types:
|
||||
* Text
|
||||
* Supported query types:
|
||||
* Term, Phrase, Match, Match Phrase
|
||||
* Conjunction, Disjunction, Boolean
|
||||
* Simple query syntax for human entry
|
||||
* Search result match highlighting
|
||||
|
||||
## Indexing
|
||||
|
||||
message := struct{
|
||||
From: "marty.schoch@gmail.com",
|
||||
Body: "bleve indexing is easy",
|
||||
}
|
||||
|
||||
mapping := bleve.NewIndexMapping()
|
||||
index, _ := bleve.Open("example.bleve", mapping)
|
||||
index.IndexId(message)
|
||||
|
||||
## Querying
|
||||
|
||||
mapping := bleve.NewIndexMapping()
|
||||
index, _ := bleve.Open("example.bleve", mapping)
|
||||
query := bleve.NewSyntaxQuery("bleve")
|
||||
searchRequest := bleve.NewSearchRequest(query)
|
||||
searchResult, _ := index.Search(searchRequest)
|
||||
|
||||
|
||||
## Status
|
||||
|
||||
[![Build Status](https://drone.io/github.com/couchbaselabs/bleve/status.png)](https://drone.io/github.com/couchbaselabs/bleve/latest)
|
||||
[![Coverage Status](https://coveralls.io/repos/couchbaselabs/bleve/badge.png?branch=master)](https://coveralls.io/r/couchbaselabs/bleve?branch=master)
|
||||
|
||||
A modern text indexing library for go.
|
||||
[![Coverage Status](https://coveralls.io/repos/couchbaselabs/bleve/badge.png?branch=master)](https://coveralls.io/r/couchbaselabs/bleve?branch=master)
|
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
|
@ -48,7 +48,7 @@ func main() {
|
|||
// build a search with the provided parameters
|
||||
queryString := strings.Join(flag.Args(), " ")
|
||||
query := bleve.NewSyntaxQuery(queryString)
|
||||
searchRequest := bleve.NewSearchRequest(query, *limit, *skip, *explain)
|
||||
searchRequest := bleve.NewSearchRequestOptions(query, *limit, *skip, *explain)
|
||||
|
||||
// enable highlights if requested
|
||||
if *includeHighlights {
|
||||
|
|
|
@ -73,7 +73,11 @@ func (r *SearchRequest) UnmarshalJSON(input []byte) error {
|
|||
|
||||
}
|
||||
|
||||
func NewSearchRequest(q Query, size, from int, explain bool) *SearchRequest {
|
||||
func NewSearchRequest(q Query) *SearchRequest {
|
||||
return NewSearchRequestOptions(q, 10, 0, false)
|
||||
}
|
||||
|
||||
func NewSearchRequestOptions(q Query, size, from int, explain bool) *SearchRequest {
|
||||
return &SearchRequest{
|
||||
Query: q,
|
||||
Size: size,
|
||||
|
|
Loading…
Reference in New Issue