I'd like to filter with the following code. However I recieve an invalid memory error. I'm curious if you could point me in the right direction. I'm somewhat new to both go and rethink, please excuse my ignorance.
I'd like to search the "name" field for a keyword substring. There's an Expr line in the docs but I'm lost as to what the Field,Nth,Field chaining does. Could you clarify this for me?
/*
SearchByKeyword borrowed from imagelib
*/
func (im *ImageService) SearchByKeyword(keyword string) []interface{} {
var err error
rows, err := r.Table("images").Filter(func(row r.RqlTerm) r.RqlTerm {
//Expr("id:0,name:mlucy,foo:bar").Match("name:(\\w+)").Field("groups").Nth(0).Field("str")
s := []string{"^", keyword}
fmt.Printf(strings.Join(s, " "))
return r.Expr(row.Field("name")).Match(s)
}).Run(session)
if err != nil {
fmt.Println(err)
}
fmt.Println(rows)
....