Giter Site home page Giter Site logo

Comments (2)

fergiemcdowall avatar fergiemcdowall commented on June 2, 2024

Thanks for the bug report @ApsaraDhanasekar11. I think I understand your problem, but there are too many variables to reproduce it accurately.

Could you include a standalone script/test that demonstrates the issue?

from search-index.

ApsaraDhanasekar11 avatar ApsaraDhanasekar11 commented on June 2, 2024

Hi @fergiemcdowall , thanks for replying back. Please find the below example code and help us with details. Thanks!

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

let data = [
{
_id: 'a',
description: 'Use template to list'
},
{
_id: 'b',
description: 'All versions and updates'
},
{
_id: 'c',
description: 'Final is the file name'
}
];

const result = await idx.PUT(data, {
storeVectors: true });

// results is :: [
{ _id: 'a', operation: 'PUT', status: 'CREATED' },
{ _id: 'b', operation: 'PUT', status: 'CREATED' },
{ _id: 'c', operation: 'PUT', status: 'CREATED' }
]

// ****** The above code creates the index as below::
{ key: 'description:file#1.00', value: [ 'c' ] }
{ key: 'description:final#1.00', value: [ 'c' ] }
{ key: 'description:list#1.00', value: [ 'a' ] }
{ key: 'description:name#1.00', value: [ 'c' ] }
{ key: 'description:template#1.00', value: [ 'a' ] }
{ key: 'description:updates#1.00', value: [ 'b' ] }
{ key: 'description:use#1.00', value: [ 'a' ] }
{ key: 'description:versions#1.00', value: [ 'b' ] }
{ key: '○DOCUMENT_COUNT○', value: 3 }
{
key: '○DOC_RAW○a○',
value: { _id: 'a', description: 'Use template to list' }
}
{
key: '○DOC_RAW○b○',
value: { _id: 'b', description: 'All versions and updates' }
}
{
key: '○DOC_RAW○c○',
value: { _id: 'c', description: '"Final is the file name' }
}
{
key: '○DOC○a○',
value: {
_id: 'a',
description: [ 'list#1.00', 'template#1.00', 'to#1.00', 'use#1.00' ]
}
}
{
key: '○DOC○b○',
value: {
_id: 'b',
description: [ 'all#1.00', 'and#1.00', 'updates#1.00', 'versions#1.00' ]
}
}
{
key: '○DOC○c○',
value: {
_id: 'c',
description: [ 'file#1.00', 'final#1.00', 'is#1.00', 'name#1.00', 'the#1.00' ]
}
}
{ key: '○FIELD○description○', value: 'description' }
//// ************************* ///////

// ****** For the Search/ query : ******* //
const result = await indexedDb.QUERY( {
GET: {
FIELD: ['description'],
VALUE: {
GTE: 'versions',
LTE: 'versions'
},
}
}); ----> Tried other options like Query->(GET, SEARCH) , _SEARCH, _GET

But the result was ::
RESULT: [
{
_id: 'c',
_match: [
'description:file#1.00',
'description:final#1.00',
'description:name#1.00'
]
},
{
_id: 'a',
_match: [
'description:list#1.00',
'description:template#1.00',
'description:use#1.00'
]
},
{
_id: 'b',
_match: [ 'description:updates#1.00', 'description:versions#1.00' ]
}
],
RESULT_LENGTH: 3
} :: which is actually giving results of all previous alphabetical words from a-v (as "versions" begins with v)

While trying to identify the process flow, I noticed the GET function has internal implementation of db.createReadStream method which should actually filter the data according to the keywords passed in GTE & LTE. But looks like this is failing and instead bringing up the entire result set restricting upto the first character (alphabetic order)..

from search-index.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.