Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.44 KB

File metadata and controls

31 lines (23 loc) · 1.44 KB

Phase 8b: Enhanced Filtering & Key Optimization (Completed)

Status: Completed (2025-12-22)

This phase delivered advanced filtering capabilities and database optimizations for the Go/Bbolt target.

Delivered Features

1. Secondary Indexes

  • Declaration: :- index(predicate/arity, field).
  • Write Path: Automatically creates index_Pred_Field buckets and maintains Value:PrimaryKey entries.
  • Read Path: Uses cursor.Seek() and bytes.HasPrefix() for optimized range scans when filters match indexed fields.

2. String Operations

  • Case-Insensitive Equality: Field =@= "Value" maps to strings.EqualFold().
  • Substring Match: contains(Field, "Sub") maps to strings.Contains().

3. List Membership

  • Syntax: member(Field, [Val1, Val2]).
  • Implementation: Generates efficient Go loops/slices to check membership.

4. Key Optimization

  • Direct Lookup: Uses bucket.Get() for exact Primary Key matches.
  • Prefix Scan: Uses cursor.Seek() for composite Primary Key prefix matches.
  • Index Scan: Uses cursor.Seek() on Secondary Index buckets for indexed field matches.
  • Fallback: Gracefully falls back to full bucket scan if no index/key optimization is possible.

Verification

  • tests/test_go_index.pl: Verified index creation and write logic.
  • tests/test_go_index_read.pl: Verified optimized read logic (Index Scan).
  • tests/test_go_phase_8b.pl: Verified string ops and membership.