0

I have come up below code but not to sure how to move forward.

In short I am trying get result for such case,

When searched "ome" i need "bbb something aaa" to be found. Have tried to add tq.SetFuzziness(5) but this causes ap to crash without any error. I would appreciate any help.

    param := c.DefaultQuery("param", "")

    split := strings.Split(param, " ")

    tqs := make([]query.Query, len(split))
    for i, token := range split {
        tq := bleve.NewFuzzyQuery(token)
        tq.SetField("Content")
        //tq.SetFuzziness(5) this line cause error.
        tqs[i] = tq
    }

    allQuery := bleve.NewConjunctionQuery(tqs...)

    req := bleve.NewSearchRequest(allQuery)
    req.Highlight = bleve.NewHighlightWithStyle("html")
    req.Fields = []string{"ID", "Title", "Content", "RawContent"}
    res, err := index.Search(req)
serkan
  • 6,885
  • 4
  • 41
  • 49
  • 1
    I sincerely doubt bleve will „crash without any error“. Either there is an error or there is a panic. Please provide a [mcve]. – Markus W Mahlberg Sep 17 '19 at 07:04
  • 1
    I actually do doubt myself too since i am very new to golang. Easily i might have done something wrong. Only thing that i can assume is adding "tq.SetFuzziness(5)" multiple times. Not sure though. – serkan Sep 17 '19 at 18:28

0 Answers0