IPRIT / sphinx-promise

:mag_right::cat2: Native promise-based module for Sphinx search engine
https://www.npmjs.com/package/sphinx-promise
MIT License
4 stars 0 forks source link

Getting Nothing #1

Open kevinjuliano1020 opened 5 years ago

kevinjuliano1020 commented 5 years ago

I am not getting any response. even errors. here's my code:

const Sphinx = require('sphinx-promise');
const sphinx = new Sphinx({
    host: 'localhost', // default sphinx host
    port: 9300 // default sphinx TCP port
});

let query = 'word | anotherword';

sphinx.query(query).then(result => {
    console.log(result);
}).catch(console.error.bind(console));
IPRIT commented 5 years ago

@kevinjuliano1020 Did you set up your Database for work with Sphinx?

kevinjuliano1020 commented 5 years ago

I am actually using a tunnel from my server. when I change the port or the host I am getting a connection error. but if I put the right param it is returning nothing.

kevinjuliano1020 commented 5 years ago

you can check this screenshot https://ibb.co/mMmu20

IPRIT commented 5 years ago

@kevinjuliano1020 Please run that code with a little changes:

sphinx.query(query).then(result => {
    console.log('result:', result);
}).catch(console.error.bind(console));

If result is "result: " then you didn't find anything with that query. Or probably u need to wait while connection will be established. So you can simply wrap your query above into setTimeout for a 1-2 seconds to test it.

kevinjuliano1020 commented 5 years ago

No luck, I actually set it to 20secs setTimeout(function(){ sphinx.query(query).then(result => { console.log("test"); console.log('result:', result); }).catch(console.error.bind(console)); }, 20000); https://ibb.co/egTcpf https://ibb.co/gSrGFL also I added additional log to test. but it is not working.