Skip to content

[Bug] Filter operators (contains, notContains, isEmpty, between) broken or inconsistent across frontend and server #866

@hotlong

Description

@hotlong

Summary

The contains text search filter returns no results while equals works correctly (see screenshot). After a thorough code audit, 7 related filter issues were identified across the objectui and spec repos.

Contains operator bug screenshot

Root Cause Analysis

Bug 1 (Critical): contains filter returns empty results — Server-side double-conversion

  • Frontend sends AST: ['name', 'contains', 'Evan']
  • Server parseFilterAST() converts to { name: { $contains: 'Evan' } }
  • Driver receives { name: { $contains: 'Evan' } } but does not translate $contains → database-native (SQL/Mongo regex)
  • Results are always empty.

Other issues:

  • notContains operator missing from mapping tables
  • isEmpty/isNotEmpty only matches null, not empty strings
  • between filter renders only one input, needs min/max
  • Case sensitivity inconsistency (contains)
  • in/notIn operator expanded in frontend; drivers support natively
  • Same double-conversion bug for startsWith/endsWith

Proposed Fixes

  • Remove or refactor parseFilterAST() call and let drivers process raw AST arrays
  • Ensure drivers (esp. Memory & SQL) correctly convert $contains, $startsWith, $endsWith, $notContains to native DB queries
  • Update frontend FilterBuilder for correct input rendering & operator mapping

Reproduction

  1. ListView/Contact, filter Name with Contains, value = 'Evan'
  2. No items found; Equals with exact value works

Affected Files

  • objectui and spec repos, details in full analysis

Cross-Repo Impact

Requires coordinated changes in both objectui and spec repositories (especially data engine drivers).

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions