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

[BUG] Unable to Retrieve Values with Index #2473

Open
Joebu opened this issue Apr 16, 2024 · 0 comments
Open

[BUG] Unable to Retrieve Values with Index #2473

Joebu opened this issue Apr 16, 2024 · 0 comments
Labels

Comments

@Joebu
Copy link

Joebu commented Apr 16, 2024

Version
LiteDB 5.0.19
Windows 10 0 19045 0
.net 8.0

I'm encountering a strange problem with LiteDB where querying with an index does not return any values, while querying without the index works fine.

Code to Reproduce
this is my index
SELECT $ FROM $indexes WHERE collection = "Product";

{ "collection": "Product", "name": "_id", "expression": "$._id", "unique": true, "maxLevel": 1 } /* 2 */ { "collection": "Product", "name": "Code", "expression": "$.Code", "unique": false, "maxLevel": 1 }

when I execute the condition using $.Code it uses the index

EXPLAIN SELECT $ FROM Product Where $.Code = "021200000003";

{ "collection": "Product", "snaphost": "read", "pipe": "queryPipe", "index": { "name": "Code", "expr": "$.Code", "order": 1, "mode": "INDEX SEEK(Code = \"021200000003\")", "cost": 10 }, "lookup": { "loader": "document", "fields": "$" }, "select": { "expr": "$", "all": false } }
and when it execute the condition using code it does not

EXPLAIN SELECT $ FROM Product Where code = "021200000003";
{ "collection": "Product", "snaphost": "read", "pipe": "queryPipe", "index": { "name": "_id", "expr": "$._id", "order": 1, "mode": "FULL INDEX SCAN(_id)", "cost": 100 }, "lookup": { "loader": "document", "fields": "$" }, "filters": [ "$.code=\"021200000003\"" ], "select": { "expr": "$", "all": false } }
now when I execute the statement using the index I don't get any result only when not using the index

@Joebu Joebu added the bug label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant