Define shared search filtering, grouping, and ordering #13

Closed
opened 2026-09-03 14:22:18 +00:00 by JayKobe6k · 0 comments
Owner

Goal

Provide one typed search pipeline shared by value, function, struct, and enum searches, with deterministic result limits, nested grouping, and ordering.

Shared CLI options

  • --max-results <n> returns at most n matches and reports truncation. Define a safe default and hard maximum.
  • --group-by <field>... accepts ordered fields from translation-unit, name, function, struct, enum, and type. The first field is the outermost JSON/text grouping. Reject fields that cannot apply to the selected search target.
  • Use repeatable --order-by <field>[:asc|desc] terms. The suffix defaults to asc. This spelling avoids the parsing ambiguity of optional direction tokens in a variadic option while retaining ordered multi-key sorting.
  • Add a stable final tie-breaker based on canonical handle/source anchor so pagination and repeated output are deterministic.

Core contract

  • Represent target, filters, regexes, grouping fields, ordering terms/directions, limits, and result variants with typed structs/enums.
  • Compile/validate regexes before repository execution and report the offending option.
  • Define case sensitivity and matching against portable paths, canonical identifiers, display names, scopes, and canonical type spellings.
  • Return typed flat hits from repositories; apply backend-appropriate filtering/sorting while keeping public behavior independent of LadybugDB.
  • Render JSON groups as nested typed group objects with keys and child groups/matches, not dynamic property names.

Acceptance criteria

  • Unit tests cover multiple nesting levels, empty groups, multiple ordering terms/directions, stable ties, limits/truncation, invalid regexes, unsupported field/target combinations, and text/JSON parity.
  • --max-results 0 behavior and upper bounds are explicit.
  • Grouping never changes which matches qualify; ordering never changes grouping membership.
  • LadybugDB query parameters/results remain typed and Cypher stays inside the adapter.

Dependencies

Depends on #2, #3, #4, #5, and #10.

## Goal Provide one typed search pipeline shared by value, function, struct, and enum searches, with deterministic result limits, nested grouping, and ordering. ## Shared CLI options - `--max-results <n>` returns at most `n` matches and reports truncation. Define a safe default and hard maximum. - `--group-by <field>...` accepts ordered fields from `translation-unit`, `name`, `function`, `struct`, `enum`, and `type`. The first field is the outermost JSON/text grouping. Reject fields that cannot apply to the selected search target. - Use repeatable `--order-by <field>[:asc|desc]` terms. The suffix defaults to `asc`. This spelling avoids the parsing ambiguity of optional direction tokens in a variadic option while retaining ordered multi-key sorting. - Add a stable final tie-breaker based on canonical handle/source anchor so pagination and repeated output are deterministic. ## Core contract - Represent target, filters, regexes, grouping fields, ordering terms/directions, limits, and result variants with typed structs/enums. - Compile/validate regexes before repository execution and report the offending option. - Define case sensitivity and matching against portable paths, canonical identifiers, display names, scopes, and canonical type spellings. - Return typed flat hits from repositories; apply backend-appropriate filtering/sorting while keeping public behavior independent of LadybugDB. - Render JSON groups as nested typed group objects with keys and child groups/matches, not dynamic property names. ## Acceptance criteria - Unit tests cover multiple nesting levels, empty groups, multiple ordering terms/directions, stable ties, limits/truncation, invalid regexes, unsupported field/target combinations, and text/JSON parity. - `--max-results 0` behavior and upper bounds are explicit. - Grouping never changes which matches qualify; ordering never changes grouping membership. - LadybugDB query parameters/results remain typed and Cypher stays inside the adapter. ## Dependencies Depends on #2, #3, #4, #5, and #10.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
JayKobe6k/ClariTree#13
No description provided.