HiddenInNavigation in nxql result

Hello, Is there a way to not list the documents with the facet “HiddenInNavigation” in the result of nxql.

Scenario:

1- Add the “HiddenInNavigation” facet dynamically (via a operation which calls the 'document.addfacet' method).

2- search via the search menu.

-> result: the document is not listed

3- search via an nxql request with mixinType! = 'HiddenInNavigation'

-> result: the document is listed.

Thank you.

0 votes

1 answers

312 views

ANSWER



Hello,

I think there is not any way of doing that. From the documentation:

ecm:mixinType: a list of the document facets (DocumentModel.getFacets()) with some restrictions. 1. the facet Immutable is never seen. 2. the facets Folderish and HiddenInNavigation are never seen on document instances (only if they're on the type). 3. like for other list properties, it can be used only with operators =, <>, IN and NOT IN.

Link: https://doc.nuxeo.com/nxdoc/nxql/#special-nxql-properties

That's why using the “ecm:mixinType != 'HiddenInNavigation'” doesn't work, and the documents appear in the NXQL query.

A possible approach could be to define your own facet. Just read this for more information about creating facets: https://doc.nuxeo.com/studio/how-to-create-and-use-document-facets/

After creating the new facet (let's say, “CustomNXQLFacet”), you can add the “HiddenInNavigation” facet along with “CustomNXQLFacet” facet, and include it in the NXQL query: “… AND ecm:mixinType != 'CustomNXQLFacet'“.

Regards.

1 votes



many thanks
01/15/2020