oper parameter and relation filtering capabilities.
Overview
The Rest Generic Class package provides powerful filtering through theoper parameter, supporting:
- Simple equality and comparison operators
- Complex AND/OR logic trees
- Relation-based filtering
- Date range queries
- Full-text search patterns
E-Commerce Product Search
Scenario 1: Basic Product Catalog Filter
Goal: Show active products in stock within a price range.Scenario 2: Search by Name with Category Filter
Goal: Search for “keyboard” products in the Electronics category.The
like operator uses SQL LIKE syntax. Use % as a wildcard for partial matches. For case-insensitive searches, your database collation determines behavior.Scenario 3: Complex OR Logic - Clearance or New Arrivals
Goal: Show products that are either on clearance (low stock) or newly added.Scenario 4: Multi-Category Filter
Goal: Show products from multiple categories using IN operator.Date Range Queries
Scenario 5: Products Created This Month
Goal: List all products added in the current month.Scenario 6: Recently Updated Products
Goal: Find products updated in the last 7 days.Scenario 7: Seasonal Product Filter
Goal: Show products relevant to a specific season with date-based logic.Relation-Based Filtering
Scenario 8: Filter by Nested Relation
Goal: Find products with highly-rated reviews (rating >= 4).Scenario 9: Filter by Category and Subcategory
Goal: Show products from Electronics category where subcategory is “Accessories”.Scenario 10: Products with Tags
Goal: Find products tagged with specific keywords (many-to-many relation).Multi-Condition Complex Filters
Scenario 11: Advanced Search with All Features
Goal: Comprehensive search combining text, price, date, stock, and relations.Scenario 12: Exclude Specific Items
Goal: Show all products except specific excluded IDs and categories.Scenario 13: Null/Not Null Checks
Goal: Find products with or without a description.Performance Optimization Tips
1
Use Select to Limit Columns
Only fetch the columns you need:
2
Add Database Indexes
Index frequently filtered columns:
3
Enable Caching for Repeated Queries
4
Limit Relation Depth
Avoid loading too many nested relations:
Supported Operators
All operators are validated against the package’s allowlist. Custom operators can be added via configuration if needed.
Common Mistakes
Next Steps
- Learn about Cache Strategies to optimize repeated queries
- Explore Edge Cases for troubleshooting filter issues
- Review Configuration Reference for filter limits and operator customization