I’m trying to perform this query:
`plugin.controllers[“collection-types”].find = async (ctx) => {
const params = processFilters(
Object.fromEntries([…new URLSearchParams(ctx.request.querystring)])
);
const [sortKey, sortOrder] = params.sort.split(“:”);
const uid = ctx.request.url.split("?").shift().split("/").pop();
const req = {
...params,
page: params.page || 1,
pageSize: params.pageSize || 10,
populate: "deep,2",
};
if (sortKey) {
req.sort = {
[sortKey]: sortOrder,
};
}
if (params._q) {
const { attributes } = strapi.contentTypes[uid];
const filters = {
$or: [
{
publishing: {
permalink: {
$containsi: params._q,
},
},
},
{
banner: {
title: {
$containsi: params._q,
},
},
},
{
id: {
$containsi: params._q,
},
},
],
};
Object.keys(attributes).forEach((key) => {
if (["string", "text", "richtext"].includes(attributes[key].type)) {
filters.$or.push({ [key]: { $containsi: params._q } });
}
});
req.filters = { ...req.filters, ...filters };
}
return await strapi.entityService.findPage(uid, req);
};`
It works with the id which is not nested but it doesn’t find data for permalink nor for banner title.
This topic has been created from a Discord post (1237196059256553483) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord