Enonic version: 6.12.3
OS: OSX
I seem to have problem using filters on content queries.
When I run this I get the expected 1 content returned.
const bean = __.newBean('com.enonic.xp.lib.content.QueryContentHandler'); bean.start = 0; bean.count = 3 bean.filters = __.toScriptValue({ boolean: { must: { ids: { values: ["09970a3d-f4b9-4123-bed3-40c43273fe66"] } } } }); const data = __.toNativeObject(bean.execute());
returns:
{ "total": 1, "count": 1, "hits": [ { "_id": "09970a3d-f4b9-4123-bed3-40c43273fe66" ... } ] }
but doing the same query through the contentLib gives me loads of result…
const data = contentLib.query({ start: 0, count: 3, filters: { boolean: { must: { hasValue: { field: "_id", values: ["09970a3d-f4b9-4123-bed3-40c43273fe66"] } } } } });
or with the shorter filter:
boolean: { must: { ids: { values: ["09970a3d-f4b9-4123-bed3-40c43273fe66"] } } }
both gives med wrong result with hits:
{ "total": 56, "count": 3, "hits": [ ... ] }