fix(readme): Update readme to clarify usage of searchable fields retrieval

This commit is contained in:
2025-04-21 17:31:30 +00:00
parent ac80f90ae0
commit 969b073939
3 changed files with 9 additions and 3 deletions

View File

@@ -203,7 +203,7 @@ class Product extends SmartDataDbDoc<Product, Product> {
}
// List searchable fields
const searchableFields = getSearchableFields('Product');
const searchableFields = Product.getSearchableFields();
// 1: Exact phrase across all fields
await Product.search('"Kindle Paperwhite"');
@@ -230,7 +230,7 @@ await Product.search('');
The search functionality includes:
- `@searchable()` decorator for marking fields as searchable
- `getSearchableFields()` to list searchable fields for a model
- `Class.getSearchableFields()` static method to list searchable fields for a model
- `search(query: string)` method supporting:
- Exact phrase matches (`"my exact string"` or `'my exact string'`)
- Fieldscoped exact & wildcard searches (`field:value`, `field:Air*`)