goriakpbc icon indicating copy to clipboard operation
goriakpbc copied to clipboard

Search Errors don't seem to be in a usable format

Open bmhatfield opened this issue 11 years ago • 2 comments

For example, given this sample code:

r, a, b, e := riakClient.Search(&riak.Search{Q: query, Index: "invites"})

if e != nil {
    println(e)
}

with a junk query Dolphins:1 AND Forks:

displays the following error:

(0x6cee80,0xc210098210)

Given that the empty querystring after Forks is not valid (I think), it should output something more to that effect. The command-line search client outputs something like 'badmatch'.

bmhatfield avatar Jun 08 '14 01:06 bmhatfield

It's very strange, but it seems to have something to do with println. If I use fmt.Printf instead it returns a more complete error.

   fmt.Printf("%v\n", e)
Error processing incoming message: error:{badmatch,
                                          {error,
                                           {lucene_parse,
                                            "syntax error before: "}}}:[{riak_search_client,
                                                                         parse_query,
...

tpjg avatar Jun 10 '14 11:06 tpjg

Println prints the same as %v except in some cases, including errors: http://golang.org/pkg/fmt/

I think perhaps that somewhere in Request or Response an error object is created in an unusual way. I couldn't figure out where. https://github.com/tpjg/goriakpbc/blob/master/client.go#L196

benatkin avatar Jul 06 '14 20:07 benatkin