Open gyaaniguy opened 11 years ago
Hey thanks for the quick response! But There are a few of more changes I had to make to make this work: BUT i am no expert! and wasn't exactly sure with every change.
forEach(weights, function (item, index) {
assert.equal(typeof item, 'number')
})
Should be
forEach(weights, function (item, index) {
assert.equal(typeof index, 'number')
})
req.push(pb.pack('>L', [len(field)]))
to
req.push(pack('>L', [len(field)]))
for(k in o) {
l += Number( obj.hasOwnProperty(k) );
}
TO
for(k in o) { l += Number( o.hasOwnProperty(k) ); }
you found an mistake in the foreach wrapper... I inverted the arguments of the callback.
I 'll fix all the bugs as soon as possible
EDIT: SORRY! I was wrong , it is working. Just that the results are not in the order that I expected.
I hate being a bother, but I think it still could be broken. SetFieldWeights doesn't seem to have any effect. Could you please look into this .
Thanks
Here's my code btw: var searchQuery = '' + str; cl.SetServer('localhost', sphinxPort); cl.SetFieldWeights({ tagds: 15000, qdt: 30000, dqb: 1 }); cl.SetMatchMode(SphinxClient.SPH_MATCH_EXTENDED);
Sorry, I forgot to change a line. it was fixed with this commit : b3ca39ea163649a57df5dbcf862eee60cce96c6e. I also wrote a little test to compare an search and the same search with different weights
https://github.com/touv/node-sphinxapi-test/blob/master/query.js https://github.com/touv/node-sphinxapi-test/blob/master/setfieldsweights.js
I compare the result with NodeJS's API and the official PHP's API. It looks the same.
https://github.com/touv/node-sphinxapi-test/blob/master/query.php https://github.com/touv/node-sphinxapi-test/blob/master/setfieldsweights.php
Tell me, if I can close this issue ?
This throws the error: AssertionError: "undefined" == "object" in line ../node_modules/sphinxapi/lib/sphinxapi.js:315:9)
This is the code. I think I notice a couple of mistakes there...
Please have a look. Thanks