Bleve is not indexing the numeric and date appropriately

259 views Asked by At

Search request on the bleve returns the response where string fields are exact but numeric and date fields are not returning as expacted

{
"back_image": "",
"cover_image": "\\storage\\8\\c9e6325b-8cd8-402b-9e37-54b7119a5c22.png",
"created_at": " \u0001\u0014s\u0002\u000b\r\u001b_,\u0000",
"id": " \u0001@\u001f\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"score": 0.02789571168954376,
"status": " \u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"tags": "i ",
"time": 1004300,
"title": "MyArtu",
"total": 1,
"type": " \u0001?x\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"updated_at": " \u0001\u0014t\u001f^\u0010,\u0004T\u0000",
"user_id": " \u0001@\u0010\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"visibility": " \u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}

Bleve is not working with the numeric values and date for me.

My Mapping Code is

    publication := bleve.NewDocumentMapping()

    publicationCoverImage := bleve.NewTextFieldMapping()
    publicationCoverImage.Store = true
    publication.AddFieldMappingsAt("cover_image",publicationCoverImage)

    publicationId := bleve.NewNumericFieldMapping()
    publicationId.Store = true
    publication.AddFieldMappingsAt("id", publicationId)

    publicationTags := bleve.NewTextFieldMapping()
    publicationTags.Store = true
    publication.AddFieldMappingsAt("tags", publicationTags)

    publicationTitle := bleve.NewTextFieldMapping()
    publicationTitle.Store = true
    publication.AddFieldMappingsAt("title", publicationTitle)

    mapping := bleve.NewIndexMapping()
    mapping.AddDocumentMapping("publication",publication)
    PublicationIndex, PublicationErr = bleve.New("publications.bleve", mapping)

Here is the code that is reponsible generating the output

for _,hit := range result.Hits {
        doc, _ := search.PublicationIndex.Document(hit.ID)
        for _, field := range doc.Fields {
            resp[string(filed.Name())] = fmt.Sprint(string(filed.Value()))
        }           
    }
0

There are 0 answers