Advanced search: How to limit results to the current folder.

How can I limit the search results to only elements contained in the current folder. What I'm using now returns all the “accuse de reception” stored in DB.

<contentView name="parent_accuse_de_reception_content">

      <title>label.contentview.accuse_de_receptions_content</title>
      <translateTitle>true</translateTitle>
      <showTitle>false</showTitle>

      <coreQueryPageProvider>
        <property name="coreSession">#{documentManager}</property>
        <property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
        <whereClause docType="accuse_de_reception_search">
          <predicate parameter="adr:num_facture" operator="=">
            <field schema="accuse_de_reception_search" name="num_facture" />
          </predicate>
          <predicate parameter="bc_base:num_bc" operator="=">
            <field schema="accuse_de_reception_search" name="num_bc" />
          </predicate>
          <predicate parameter="adr:ville" operator="=">
            <field schema="accuse_de_reception_search" name="ville" />
          </predicate>
          <predicate parameter="adr:montant" operator="=">
            <field schema="accuse_de_reception_search" name="montant" />
          </predicate>
          <fixedPart>
                ecm:isCheckedInVersion = 0 AND
                ecm:mixinType != 'HiddenInNavigation' AND 
                ecm:currentLifeCycleState != 'deleted' AND
                ecm:primaryType = 'accuse_de_reception' 
          </fixedPart>
            <sort column="dc:title" ascending="true" />
        <pageSize>20</pageSize>       
        </whereClause>
      </coreQueryPageProvider>

      <showPageSizeSelector>true</showPageSizeSelector>
      <useGlobalPageSize>true</useGlobalPageSize>
      <refresh>
        <event>documentChanged</event>
        <event>documentChildrenChanged</event>
      </refresh>
      <cacheKey>#{currentDocument.repositoryName}_#{currentDocument.id}</cacheKey>
      <cacheSize>10</cacheSize>

      <searchLayout name="accuse_de_reception_filter" filterDisplayType="quick" />
      <showFilterForm>true</showFilterForm>

      <resultLayouts>
        <layout name="accuse_de_reception_listing_ajax" title="document_listing"
          translateTitle="true" iconPath="/icons/document_listing_icon.png"
          showCSVExport="true" showPDFExport="false"
          showSyndicationLinks="true" />
      </resultLayouts>

      <selectionList>CURRENT_SELECTION</selectionList>
      <actions category="CURRENT_SELECTION_LIST" />
    </contentView>
0 votes

1 answers

2815 views

ANSWER



Hi,

In the <fixedPart> you need to add

AND ecm:parentId = ?

and then after the </whereClause> you need to add

<parameter>#{currentDocument.id}</parameter>

You can have a look at the document_content content view, which uses this mechanism.

3 votes



That's exactly what I was looking for. Thanks Manon Lumeau
07/28/2015