--
You received this message because you are subscribed to the Google Groups "bleve" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bleve+unsubscribe@googlegroups.com.
To post to this group, send email to bl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bleve/2eaa89fd-b190-43b8-914b-f5132e681527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// Mapping abstract for indextype Mapping struct{}
// BuildIndexMapping method to build an indexfunc (mapping Mapping) BuildIndexMapping() (mapping.IndexMapping, error) {
// a generic standard mapping for default character defaultTextFieldMapping := bleve.NewTextFieldMapping() defaultTextFieldMapping.Analyzer = standard.Name
// a generic reusable mapping for english text englishTextFieldMapping := bleve.NewTextFieldMapping() englishTextFieldMapping.Analyzer = en.AnalyzerName
// a generic reusable mapping for keyword text keywordFieldMapping := bleve.NewTextFieldMapping() keywordFieldMapping.Analyzer = keyword.Name
certMapping := bleve.NewDocumentMapping()
// sha1 certMapping.AddFieldMappingsAt("sha1", keywordFieldMapping)
// appid certMapping.AddFieldMappingsAt("appid", keywordFieldMapping)
// cert sha1 certMapping.AddFieldMappingsAt("csha1", keywordFieldMapping)
// cert subject certMapping.AddFieldMappingsAt("subject", defaultTextFieldMapping)
// cert issuer certMapping.AddFieldMappingsAt("issuer", defaultTextFieldMapping)
indexMapping := bleve.NewIndexMapping() indexMapping.AddDocumentMapping("cert", certMapping)
indexMapping.DefaultAnalyzer = "en"
return indexMapping, nil}// CertInfo data structure in databasetype CertInfo struct { Appid string `json:"appid"` Sha1 string `json:"sha1"` CSha1 string `json:"csha1"` Subject string `json:"subject"` Issuer string `json:"issuer"`}var certInfo CertInfo
// v is certInfo bytes.
json.Unmarshal(v, &certInfo)
// i is bleve.Index return by BuildIndexMapping method above. k is sha1 stringi.Index(string(k), certInfo)
The most common problem in these situations is that there is some subtle problem in the mapping, or that the mapping is not actually being used (things like type identification not working as expected).Can you provide the mapping (either JSON or code to build it)?Can you show the section of code which indexes the documents including the structure definition?Thanks
On Mon, Jan 16, 2017 at 10:25 PM, ttk <andt...@gmail.com> wrote:
hi, allFirst, thanks for the bleve, it's a great lib.I have three field in my document mapping and use the keywordFieldMapping,which is:keywordFieldMapping := bleve.NewTextFieldMapping()keywordFieldMapping.Analyzer = keyword.NameI use this do the search:query := bleve.NewQueryStringQuery(q)search := bleve.NewSearchRequest(query)the query q would like: hash:c1d0e8d8f75aa193b, it works very well,but if i query the like name:com.example.test, it give the No matches resultI also try to escape the \., does not work. if I query with only com.example.test,i will give the correct result.what i miss? any suggestion are appreciate.
--
You received this message because you are subscribed to the Google Groups "bleve" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bleve+un...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bleve+unsubscribe@googlegroups.com.
To post to this group, send email to bl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bleve/aa04a62d-24c2-4d6d-b3ed-1fc51c96163b%40googlegroups.com.