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

createReadStream options are failing - resulting in wrong output result set #11

Open
ApsaraDhanasekar11 opened this issue Nov 5, 2021 · 3 comments

Comments

@ApsaraDhanasekar11
Copy link

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

@loune

@loune
Copy link
Owner

loune commented Nov 6, 2021

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
})();

@ApsaraDhanasekar11
Copy link
Author

ApsaraDhanasekar11 commented Nov 8, 2021

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 ?

@loune
Copy link
Owner

loune commented Nov 10, 2021

Could you please run the code with the environment variable DEBUG=S3LevelDOWN and post the debug log here?

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

2 participants