committed by
GitHub
parent
dc9c23be34
commit
8fbef8a667
@@ -402,7 +402,7 @@ class SearchableEntity1 {
|
||||
deleted_at: Date | null
|
||||
|
||||
@Searchable()
|
||||
@Property()
|
||||
@Property({ columnType: "text" })
|
||||
searchableField: string
|
||||
|
||||
@Searchable()
|
||||
@@ -430,7 +430,7 @@ class SearchableEntity2 {
|
||||
deleted_at: Date | null
|
||||
|
||||
@Searchable()
|
||||
@Property()
|
||||
@Property({ columnType: "text" })
|
||||
searchableField: string
|
||||
|
||||
@ManyToOne(() => SearchableEntity1, { mapToPk: true })
|
||||
@@ -450,12 +450,12 @@ export {
|
||||
Entity2,
|
||||
Entity2WithUnDecoratedProp,
|
||||
InternalCircularDependencyEntity1,
|
||||
RecursiveEntity1,
|
||||
RecursiveEntity2,
|
||||
SearchableEntity1,
|
||||
SearchableEntity2,
|
||||
Product,
|
||||
ProductOption,
|
||||
ProductOptionValue,
|
||||
ProductVariant,
|
||||
RecursiveEntity1,
|
||||
RecursiveEntity2,
|
||||
SearchableEntity1,
|
||||
SearchableEntity2,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { EntityMetadata, EntitySchema, ReferenceType } from "@mikro-orm/core"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import type {
|
||||
FindOptions,
|
||||
EntityClass,
|
||||
EntityProperty,
|
||||
FindOneOptions,
|
||||
FindOptions,
|
||||
} from "@mikro-orm/core"
|
||||
import { EntityMetadata, EntitySchema, ReferenceType } from "@mikro-orm/core"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
|
||||
export const FreeTextSearchFilterKey = "freeTextSearch"
|
||||
|
||||
@@ -57,8 +57,13 @@ function retrieveRelationsConstraints(
|
||||
continue
|
||||
}
|
||||
|
||||
const isText = propertyConfiguration?.columnTypes?.includes("text")
|
||||
const columnName = isText
|
||||
? propertyConfiguration.name
|
||||
: `${propertyConfiguration.name}::text`
|
||||
|
||||
relationFreeTextSearchWhere.push({
|
||||
[propertyConfiguration.name]: {
|
||||
[columnName]: {
|
||||
$ilike: `%${searchValue}%`,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user