Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1165 +/- ##
==========================================
- Coverage 61.80% 61.79% -0.01%
==========================================
Files 293 293
Lines 19362 19362
==========================================
- Hits 11966 11965 -1
- Misses 6825 6826 +1
Partials 571 571 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replaces the "not implemented" stub with a working implementation that parses the query, extracts the selector, and returns a QueryPlan with the _all_docs fallback index and CouchDB's default limit of 25.
Explain now queries mango indexes and selects the best match by checking selector field coverage and sort field coverage, falling back to _all_docs when no index matches.
Explain now respects the use_index query parameter by looking up the specified index directly, falling back to auto-selection if not found (matching CouchDB's hint semantics). Extracted buildMangoIndexMap to share index result construction between lookupMangoIndex and selectMangoIndex.
An empty sortFields slice caused the loop to not execute, falling through to return true. This made selectMangoIndex incorrectly match any index even when no sort was requested.
3b5a4d5 to
ecfb3c9
Compare
…nd's behavior Unskip SQLite integration test for Explain and configure expected plan.
…CouchDB behavior Validate field directions in ExtractIndexFields and return HTTP 400 when an index definition mixes ascending and descending sort directions.
…uery CouchDB selects the index with the least fields when multiple candidates cover the selector, indicated by the too_many_fields reason code.
When multiple indexes match with the same field count, CouchDB picks the one whose ddoc name comes first alphabetically.
…ed candidates coversSelector now matches indexes covering at least one selector field, matching CouchDB behavior. selectMangoIndex collects candidates into a slice and sorts by (fewest fields, alphabetical ddoc) for clarity.
…erion coversSelector now returns the overlap count instead of a boolean, and indexCandidate.cmp sorts by most overlap first, then fewest fields, then alphabetical ddoc name, matching CouchDB's less_overlap behavior.
Move the default find limit from the SQLite driver into x/options so FindLimit() never returns a negative value, matching CouchDB behavior.
…he index is not found CouchDB treats use_index as advisory — if the specified index doesn't exist, it falls back to the best available index and returns a warning. This matches that behavior by implementing driver.RowsWarner on the rows struct.
CouchDB returns "no matching index found, create an index to optimize query time" when _find falls back to _all_docs. Add the same warning via the RowsWarner interface. Also document that Find currently ignores mango indexes entirely and should be fixed to use them.
$in can't use SQLite indexes and its SQL IN doesn't match CouchDB's deep equality for non-scalar or mixed-type values. Let the in-memory fallback handle it correctly instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.