createReadStream options are failing - resulting in wrong output result set
Opened this issue · 3 comments
Hi, I tried to add some indexed data to my S3 bucket for (Search functionality) using the s3leveldown module. The data is being created properly with indexes. But when I read/search/query using the readstream -> the GTE,LTE options are not being applied and instead it returns the entire result set. Can someone help on this ? Thank you in advance !
An example ::
const levelup = require('levelup');
const si = require('search-index');
const s3leveldown = require('s3leveldown');
const s3Store = await levelup(s3leveldown(bucketName, S3Client));
const idx = await si({
db: s3Store,
storeVectors: true
});
idx.PUT(somedata) // creates idx data in s3 bucket
await s3Store.createReadStream(GTE:'test',LTE:'test')
.on('data', d => { console.log(d); }). => results with entire data set
Hi @ApsaraDhanasekar11 I can't repreoduce the issue. Are you sure you are using the right keys gte
and lte
? Here's a quick test I did:
(async () => {
const db = levelup(s3leveldown(bucket));
await db.put('cat', 'orange');
await db.put('dog', 'black');
await db.createReadStream({ gte:'test', lte:'test' })
.on('data', data => { console.log('data', data.key.toString(), data); })
.on('close', () => { console.log('done test!') });
// ^ no data returned
await db.createReadStream({ gte:'cat', lte:'cat' })
.on('data', data => { console.log('data', data.key.toString(), data); })
.on('close', () => { console.log('done cat!') });
// ^ cat returned
})();
Hi @loune , thanks for replying back. I tried the above same example. When the keyword is 'cat' (which is the key/id) its working fine, but when i give the keyword as 'orange', it brings me all the results..Like in the case::
await db.createReadStream({ gte:'orange', lte:'orange' })
.on('data', data => { console.log('data', data.key.toString(), data); })
.on('close', () => { console.log('done test!') }); // returns both
RESULT OUTPUT::
data cat=orange
data dog=black
done test!
P.S : Where I actually want the "value" to be searched/ restricted upon. Then how can I get about this ?
Could you please run the code with the environment variable DEBUG=S3LevelDOWN
and post the debug log here?