#I have this query search with some filtering, and it's not working.

2 messages · Page 1 of 1 (latest)

worthy charm
#

my query:
const searchResult = await ( await getPayload() ).find({ collection: doc, limit: limit, page: page, where: { ...(category ? { 'categories.slug': { equals: category } } : {}), ...(tag ? { 'tags.slug': { equals: tag } } : {}), ...(brand && doc === 'products' ? { 'brand.slug': { equals: brand } } : {}), ...(query ? { or: [ { title: { like: query, }, }, { 'meta.description': { like: query, }, }, { 'meta.title': { like: query, }, }, { slug: { like: query, }, }, ], } : {}), _status: { equals: 'published', }, or: [ { visibility: { equals: 'all' } }, { visibility: { equals: 'search' } } ], }, })
it's only work i comment this lines of code:
_status: { equals: 'published', }, or: [ { visibility: { equals: 'all' } }, { visibility: { equals: 'search' } } ],