feat(utils): Support free text configuration (#6942)
**What** - Add support for searchable entity properties to configure default free text search when providing a `q` filter - `@Searchable` decorator to mark a property or relation to be searchable form the current entity FIXES CORE-1910
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
import {
|
||||
BeforeCreate,
|
||||
Cascade,
|
||||
Collection,
|
||||
Entity,
|
||||
Filter,
|
||||
Formula,
|
||||
OnInit,
|
||||
OnLoad,
|
||||
OneToMany,
|
||||
OnInit,
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import {
|
||||
DALUtils,
|
||||
createPsqlIndexStatementHelper,
|
||||
DALUtils,
|
||||
generateEntityId,
|
||||
Searchable,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
import { DAL } from "@medusajs/types"
|
||||
@@ -64,6 +63,7 @@ export class InventoryItem {
|
||||
deleted_at: Date | null = null
|
||||
|
||||
@InventoryItemSkuIndex.MikroORMIndex()
|
||||
@Searchable()
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
sku: string | null = null
|
||||
|
||||
@@ -94,9 +94,11 @@ export class InventoryItem {
|
||||
@Property({ columnType: "boolean" })
|
||||
requires_shipping: boolean = true
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
description: string | null = null
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
title: string | null = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user