Content Query returns data of different content type even when type is mentioned. This issue occurs when the attribute “_name” is same for both the content types.
What does your query look like? Can you share it here? Does the content type name also include the app name on the following format:
my.app.name:mycontenttypename or is it just the content type name by itself? Have you tried testing your query using apps such as repoXPlorer or the Node Search in Data Toolbox?
PFB, the query
contentTypes: [app.name + “contentype name”],
query: “_name = '”’"
And yes the content type name is in the format you have mentioned.
I tried the following query in repoXPlorer and it returned proper data.
type LIKE “no.posten.website:content_type_name” AND _name like "value"
Do not use LIKE if you actually mean equivalence. Then you should use the equals symbol instead:
type = "no.posten.website:content_type_name" AND _name = "value"
Only use LIKE if you need to use wild cards, such as when searching for results that begin with a specific string prefix:
type LIKE "no.posten.website:content_type_na*"
Why the query fails when you use equivalence, but succeeds with using LIKE, I cannot say. Sorry.
Wait a minute. Did you forget the colon between the app name and the content type name?
In other words, NOT
contentTypes: [app.name + "contentype name"],
contentTypes: [app.name + ":" + "contentype name"],
type = “no.posten.website:content_type_name” AND _name = “value” this query I added just for the repo explorer. The actual query in the controller is
contentTypes: [app.name + ‘:content_type_name’],
query: “_name = '” + content_type_value + “’”