Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doRequest > just read 0 bytes into header! #19

Open
hengfeiyang opened this issue May 23, 2016 · 1 comment
Open

doRequest > just read 0 bytes into header! #19

hengfeiyang opened this issue May 23, 2016 · 1 comment

Comments

@hengfeiyang
Copy link

hengfeiyang commented May 23, 2016

send two query in same conn will occur this error:
doRequest > just read 0 bytes into header!

like this:

cli := sphinx.NewClient().SetServer(sphinxIP, sphinxPort)
wds, err := cli.BuildKeywords(keyword, "content", false)
    var newKeyword []string
    for _, wd := range wds {
        if len([]rune(wd.Tokenized)) >=2 {
            newKeyword = append(newKeyword, wd.Tokenized)
        }
    }
    res, err := cli.Query(strings.Join(newKeyword, "|"), "content addcontent", "")
    if err != nil {
        return total, rows, err
    }

will return err:

doRequest > just read 0 bytes into header!

@hengfeiyang
Copy link
Author

i found it, sphinx default is not persist connection, connection will close by server when done a query.
so, you should close client conn when it is not persist connection, or use client.Open() to use persist connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant