func BleveType() string
to them. How can I add a type to the indexed document, so that I can build queries to only list accounts or groups? Or should I be using two indexes for that? Ideally I can later query for accounts and groups and get a mixed set of results, but for that I need to have a property in the index ... but how if I cannot add it to the protobuf?
@mschoch I have a code https://play.golang.org/p/Iq6YfMF7LGk
When I run my code, I get an error
start batch indexing....
panic: runtime error: index out of range [-1]
goroutine 25 [running]:
github.com/blevesearch/zap/v11.mergeStoredAndRemap.func2(0xc001483130, 0x9, 0x74, 0xc01181aeab, 0xc, 0xc, 0x0, 0x0, 0x0, 0x1)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/merge.go:687 +0x579
github.com/blevesearch/zap/v11.(*SegmentBase).visitDocument(0xc0083ca000, 0xc00041baa0, 0x1287, 0xc00038f618, 0x19, 0x0)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/segment.go:384 +0x383
github.com/blevesearch/zap/v11.mergeStoredAndRemap(0xc007a80c80, 0xa, 0xa, 0xc007a80c30, 0xa, 0xa, 0xc004103380, 0xc016700000, 0x271a2, 0x271a2, ...)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/merge.go:685 +0x47f
github.com/blevesearch/zap/v11.MergeToWriter(0xc007a80c80, 0xa, 0xa, 0xc007a80c30, 0xa, 0xa, 0x400, 0xc004103350, 0xc00c0cd5c0, 0x203001, ...)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/merge.go:132 +0x1ef
github.com/blevesearch/zap/v11.mergeSegmentBases(0xc007a80c80, 0xa, 0xa, 0xc007a80c30, 0xa, 0xa, 0xc013fcfe90, 0x22, 0xc000000400, 0xc00c0cd5c0, ...)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/merge.go:79 +0x24c
github.com/blevesearch/zap/v11.(*ZapPlugin).Merge(0xfd0548, 0xc013f9ae60, 0xa, 0xa, 0xc007a80c30, 0xa, 0xa, 0xc013fcfe90, 0x22, 0xc00c0cd5c0, ...)
/home/mandeep/work/pkg/mod/github.com/blevesearch/zap/v11@v11.0.9/merge.go:54 +0x14f
github.com/blevesearch/bleve/index/scorch.(*Scorch).planMergeAtSnapshot(0xc0002c2000, 0xb68640, 0xc0000c2040, 0xc00030a000, 0xc00e8d4e00, 0x0, 0x0)
/home/mandeep/work/pkg/mod/github.com/blevesearch/bleve@v1.0.9/index/scorch/merge.go:321 +0xad9
github.com/blevesearch/bleve/index/scorch.(*Scorch).mergerLoop(0xc0002c2000)
/home/mandeep/work/pkg/mod/github.com/blevesearch/bleve@v1.0.9/index/scorch/merge.go:68 +0x2c7
created by github.com/blevesearch/bleve/index/scorch.(*Scorch).Open
/home/mandeep/work/pkg/mod/github.com/blevesearch/bleve@v1.0.9/index/scorch/scorch.go:206 +0x125
exit status 2
Any problem on this simple code?
@mschoch Thanks for being so active in the community.
I have a data with field "age" : "22" 22 as string with ID 1 and another data with field "age" : 22 as number with ID 2.
My searching
bleve.NewQueryStringQuery(age:22)
I get ids both [1,2]
How can I use query to query only number age and only string age?
Also seperate between string "false" and boolean false in QueryStringQuery
@mschoch
For matching queries related to numeric to match data with integer age 22
bleve.NewQueryStringQuery("age:>=22 age:<=22") seems to work
FOr string to match data with string age "22"
bleve.NewQueryStringQuery("age:'22' ")
What do u think on this?
Or is there anything something like for boolean we use isEmployee:T* . Is there any anything for numeric without doing bleve.NewQueryStringQuery("age:>=22 age:<=22") ?
Hello, I expect I'm making some beginner mistakes here with the mappers... can someone take a look at this?
type Note struct {
id string
title string
blocks []BasicBlock
}
func (n Note) Type() string {
return "note"
}
type BasicBlock struct {
id string
contents string
}
func (b BasicBlock) Type() string {
return "block"
}
englishMapping := bleve.NewTextFieldMapping()
englishMapping.Analyzer = "en"
blockMapping := bleve.NewDocumentMapping()
blockMapping.AddFieldMappingsAt("contents", englishMapping)
noteMapping := bleve.NewDocumentMapping()
noteMapping.AddFieldMappingsAt("title", englishMapping)
noteMapping.AddSubDocumentMapping("blocks", blockMapping)
indexMapping := bleve.NewIndexMapping()
indexMapping.AddDocumentMapping(Note{}.Type(), noteMapping)
All queries return zero results except MatchAllQueries
. Ideas?
index.Index("note1.org", Note{id: "note1.org", title: "note1.org"})
query := bleve.NewMatchQuery("note1.org")
search := bleve.NewSearchRequest(query)
searchResults, err := index.Search(search)