Skip to content

Comments

refactor: make Lucene parser SQL generation generic for PostgreSQL, M…#6

Merged
Lutherwaves merged 1 commit intomainfrom
claude/review-parser-sql-compatibility-PmMMK
Dec 31, 2025
Merged

refactor: make Lucene parser SQL generation generic for PostgreSQL, M…#6
Lutherwaves merged 1 commit intomainfrom
claude/review-parser-sql-compatibility-PmMMK

Conversation

@Lutherwaves
Copy link
Owner

…ySQL, and SQLite

BREAKING CHANGE: ParseToSQL() now requires a provider parameter

Changes:

  • Renamed postgres_driver.go to sql_driver.go for generic SQL support
  • Refactored PostgresJSONBDriver to SQLDriver with provider field
  • Added provider-specific switch statements for:
    • Case-insensitive LIKE (ILIKE vs LOWER() vs LIKE)
    • Fuzzy search (similarity() vs SOUNDEX() vs error)
    • JSON field extraction (JSONB ->> vs JSON_EXTRACT)
    • Parameter placeholders ($N vs ?)
  • Updated ParseToSQL() to accept provider string parameter
  • Updated SQLAdapter.Search() to pass provider to parser
  • Updated all tests to include "postgresql" provider parameter

Provider-specific implementations:

  • PostgreSQL: ILIKE, ::text casting, similarity(), JSONB ->> operators, $N placeholders
  • MySQL: LOWER() + LIKE, JSON_UNQUOTE(JSON_EXTRACT()), SOUNDEX(), ? placeholders
  • SQLite: LIKE (case-insensitive), JSON_EXTRACT(), no fuzzy search, ? placeholders

This follows the existing codebase pattern used in storage/sql.go for handling provider-specific SQL differences via switch statements.

@Lutherwaves Lutherwaves self-assigned this Dec 31, 2025
…ySQL, and SQLite

- Renamed postgres_driver.go to sql_driver.go for generic SQL support
- Refactored PostgresJSONBDriver to SQLDriver with provider field
- Added provider-specific switch statements for:
  * Case-insensitive LIKE (ILIKE vs LOWER() vs LIKE)
  * Fuzzy search (similarity() vs SOUNDEX() vs error)
  * JSON field extraction (JSONB ->> vs JSON_EXTRACT)
  * Parameter placeholders ($N vs ?)
- Updated ParseToSQL() to accept provider string parameter
- Updated SQLAdapter.Search() to pass provider to parser
- Updated all tests to include "postgresql" provider parameter
- PostgreSQL: ILIKE, ::text casting, similarity(), JSONB ->> operators, $N placeholders
- MySQL: LOWER() + LIKE, JSON_UNQUOTE(JSON_EXTRACT()), SOUNDEX(), ? placeholders
- SQLite: LIKE (case-insensitive), JSON_EXTRACT(), no fuzzy search, ? placeholders
@Lutherwaves Lutherwaves force-pushed the claude/review-parser-sql-compatibility-PmMMK branch from 531e4c4 to 2caa6b3 Compare December 31, 2025 14:53
@Lutherwaves Lutherwaves merged commit aa90626 into main Dec 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant