Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

BUG:can't search utf8 string ( and can't display correct utf8 encoding result) #3

@olddog

Description

@olddog

When i query '测试' or other string。。。example: 'ふじこ' 。。node-sphinxapi display some error.Whether it not support the search for utf8 encoding string
btw: it do not display correctly results ( utf8 encoding)

the code 1:
var SphinxClient = require ("./node-sphinxapi/lib/sphinxapi.js"),
assert = require('assert');

var cl = new SphinxClient();
cl.SetServer('127.0.0.1', 9312);
cl.Query('忍者', 'xml', function(err, res) { 
      console.log(err, res);
});

I put 'console' in sphinxapi.js (line: 456)

    console.log(err).
            console.log(response).
    console.log(response.toString('utf8')).

the result is:
[Error: searchd error: invalid weight count -1914142587 (should be in 0..256 range)]
null

e:\node-sphinxapi\lib\sphinxapi.js:459
                var max_ = response.length
                 ^
TypeError: Cannot read property 'length' of null
    at E:\project\root\apps\app\minefield\gl\node-sphinxapi\lib\sphinxapi.js:459:22
    at Socket.<anonymous> (E:\project\root\apps\app\minefield\gl\node-sphinxapi\lib\sphinxapi.js:183:7)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:377:14)

the code 2:
var SphinxClient = require ("./node-sphinxapi/lib/sphinxapi.js"),
assert = require('assert');

var cl = new SphinxClient();
cl.SetServer('127.0.0.1', 9312);
cl.Query('loli', 'xml', function(err, res) { 
        console.log(err, res);
});

result is :
null [ { error: '',
warning: '',
status: [ 0 ],
fields: [ 'name' ],
attrs: [ [Object], [Object] ],
matches: [ [Object] ],
total: 1,
total_found: 1,
time: 0.001,
words: [ [Object] ] } ]
I put 'console' in sphinxapi.js (line: 456)
console.log(err).
console.log(response).
console.log(response.toString('utf8')).
its display some data like:
null
<Buffer 00 00 00 00 00 00 00 01 00 00 00 04 6e 61 6d 65 00 00 00 02 00 00 ...>
loli忍者 .......

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions