cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter in the Single/Multiple Document suggestion widget Documents fetched

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

I want to specify into my Nuxeo studio a form with a suggestion box mapped on a Single/Multiple Document suggestion. All work well, but I want to filter the suggestions returned to fetch only a specific kind of documents or path.

How can I do that ?

1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Dear Me,

So you must have into your form definition (in creation or edition) a single or multiple Document suggestion widget. You have into this widget a field called "document page provider name". Here you will specify the filter.

Today you can't specify the filter directly in studio, waiting that, you can go to:

  • Advanced Settings > XML Extensions > New...
  • Choose the name of your choice that express the filter behavior and validate
  • And add in it the following xml fragment:

_

<extension target="org.nuxeo.ecm.platform.query.api.PageProviderService"
  point="providers">
 
    <coreQueryPageProvider name="ListeDiffusion">
      <pattern quoteParameters="false" escapeParameters="true">
        SELECT * FROM MyDocument WHERE ecm:fulltext LIKE '?*' AND ecm:mixinType !=
        'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND
        ecm:currentLifeCycleState != 'deleted'
      </pattern>
      <!-- sort column="dc:title" ascending="true" / sort by fulltext relevance -->
      <pageSize>5</pageSize>
    </coreQueryPageProvider>

</extension>

You will recognize the NXQL syntax. With your large knowledge on this language, I think you have enough to what you want.

View answer in original post

11 REPLIES 11

Édouard_Mercier
Champ on-the-rise
Champ on-the-rise

Thank you @ThibArg and @thierry-delprat for your answers, which work like a charm. The Page Provider is given an implicit first parameter, which is the text that the end-user has typed in the widget, which accounts for the exception I was experiencing.

Sorry @florent-guillaume for spamming the Nuxeo Studio Answers web site, I will take extra care next time. Nevertheless, I'm pretty sure that other Nuxeo developers will enjoy those detailed explanations 😉

The problem is not the explanations, thanks for providing them and telling us about what you tried. The problem is about the format.