Uploaded image for project: 'Nuxeo Documentation'
  1. Nuxeo Documentation
  2. NXDOC-1173

add an example of a search with a page provider using several aggregates in REST API 'search' endpoint documentation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.10, Fast Track (FT)
    • Fix Version/s: 8.10, Fast Track (FT)
    • Component/s: REST API

      Description

      In https://doc.nuxeo.com/nxdoc/search-endpoints/

      Page provider (Studio URL):

        <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
          <doctype name="testcase_pp" extends="Document">
            <facet name="ContentViewDisplay"/>
            <facet name="SavedSearch"/>
            <facet name="HiddenInNavigation"/>
            <schema name="testcase_pp"/>
          </doctype>
        </extension>
      
        <extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">
          <genericPageProvider class="org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider" name="testcase">
            <property name="coreSession">#{documentManager}</property>
            <whereClause>
              <fixedPart>ecm:mixinType != 'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'deleted'</fixedPart>
            </whereClause>
            <searchDocumentType>testcase_pp</searchDocumentType>
            <aggregates>
              <aggregate id="dublincore_source_agg" type="terms" parameter="dc:source">
                <field schema="testcase_pp" name="dublincore_source_agg"/>
                <properties>
                  <property name="order">term asc</property>
                </properties>
              </aggregate>
              <aggregate id="dublincore_rights_agg" type="terms" parameter="dc:rights">
                <field schema="testcase_pp" name="dublincore_rights_agg"/>
                <properties>
                  <property name="order">term asc</property>
                </properties>
              </aggregate>
            </aggregates>
            <pageSize>10</pageSize>
          </genericPageProvider>
        </extension>
      

      HTTP request:

      GET http://localhost:8080/nuxeo/api/v1/search/pp/testcase/execute?testcase_pp%3Adublincore_source_agg=%5B%22source1%22%5D&testcase_pp%3Adublincore_rights_agg=%5B%22rights1%22%5D
      

      or multivalued requests:

      GET http://localhost:8080/nuxeo/api/v1/search/pp/testcase/execute?testcase_pp%3Adublincore_source_agg%3D%5B%22source1%22%5D%26testcase_pp%3Adublincore_rights_agg%3D%5B%22rights1%22%2C%22rights2%22%5D
      

      In https://doc.nuxeo.com/nxdoc/search-endpoints/

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 10 minutes
                1h 10m