Fix: Enhance V3 Search with 'contains', 'startswith', 'endswith' operators and improve error reporting.
This commit is contained in:
@@ -18,7 +18,7 @@ The V3 CRUD API (`/v3/crud/`) is designed to run in parallel with legacy V1 and
|
||||
- **Data-Driven Configuration**: Uses the modern format in `app/ae_obj_types_def.py` to map objects to tables and models.
|
||||
- **Advanced Search (POST)**: Supports complex, nested filtering via `POST /v3/crud/{obj_type}/search`.
|
||||
- Recursive AND/OR logic.
|
||||
- Full operator support: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `like`, `in`, `is_null`, `is_not_null`.
|
||||
- Full operator support: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `is_null`, `is_not_null`, `like`, `contains`, `startswith`, `endswith`.
|
||||
- Safe parameterization using unique generated names (e.g., `:sp_1`) to prevent collisions.
|
||||
|
||||
## 2. Backward Compatibility Strategy
|
||||
|
||||
@@ -73,6 +73,25 @@ Use the `q` property in your search body for a general keyword search across ind
|
||||
}
|
||||
```
|
||||
|
||||
### D. Supported Search Operators
|
||||
The `op` property in a `SearchFilter` supports the following values:
|
||||
|
||||
| Operator | SQL equivalent | Description |
|
||||
| --- | --- | --- |
|
||||
| `eq` | `=` | Equal to |
|
||||
| `ne` | `!=` | Not equal to |
|
||||
| `gt` | `>` | Greater than |
|
||||
| `gte` | `>=` | Greater than or equal to |
|
||||
| `lt` | `<` | Less than |
|
||||
| `lte` | `<=` | Less than or equal to |
|
||||
| `in` | `IN (...)` | Matches any value in a provided list |
|
||||
| `is_null` | `IS NULL` | Field is null (ignores `value`) |
|
||||
| `is_not_null` | `IS NOT NULL` | Field is not null (ignores `value`) |
|
||||
| `like` | `LIKE` | Standard SQL LIKE (requires manual `%` in `value`) |
|
||||
| `contains` | `LIKE %val%` | Wraps value in `%` automatically |
|
||||
| `startswith` | `LIKE val%` | Appends `%` to value automatically |
|
||||
| `endswith` | `LIKE %val` | Prepends `%` to value automatically |
|
||||
|
||||
---
|
||||
|
||||
## 4. Authentication in V3
|
||||
|
||||
Reference in New Issue
Block a user