Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-14879

Update PageProvider interface and service so as to include Aggregates support



    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: Query & PageProvider


      • a method for getting the aggregates. Aggregates should be typed.
      • a contribution for specifying aggregates that should be fetched, unless this is done in NXQL (to be specified)
      • an implementation of the construction of the query for elastic search, in the ElasticSearchPageProvider.

      Unsupported on other Page providers.

      About contribution for specifying aggregates
      This involves to define the descriptors to be added to the page provider definition in order to contribute all the aggregates that will have to be returned along with the query result.

      About an aggregate:

      • it has a unique id within the scope of a content view
      • it is on a particular document property.
      • it has a type

      Aggregate types can be found in ES doc. We'll first foucs on two types:

      • cardinality (for string document properties)
      • histogram (for date/numeric document properties)

      Depending on the type of the aggregate, additional information options to be added in the page provider definition. For instance, the cardinality have a precision_threshold option and histogram have interval option. This kind of option will be given dynamically from the higher layer but we might want to set default values.

      Suggestion of implementation

      Page Provider definition

          <contentView name="advanced_search">
            <genericPageProvider name="AdvancedSearch_ES"
              <property name="coreSession">#{documentManager}</property>
              <property name="maxResults">-1</property>
              <aggregates docType="AdvancedSearch">
                  <aggregate id="dc_coverage_agg" type="term" parameter="dc:coverage">
                    <field schema="advanced_search" name="coverage_agg" />
                      <property name="precision_threshold">100</property>
                      <property name="rehash">false</property>
                   <aggregate id="dc_created_agg" type="date_histogram" parameter="dc:created">
                    <field schema="advanced_search" name="created_agg" />
                      <property name="interval">1M</property>
                      <property name="format">yyyy-MM-dd"</property>
                  <aggregate id="common_size_agg" type="histogram" parameter="common:size">
                    <field schema="advanced_search" name="size_agg" />
                      <property name="interval">1000</property>
                      <property name="min_doc_count">10</property>
                 <!-- we can even define aggregate properties directly in json -->
                <aggregate id="rings_around_amsterdam" type="geo_distance" parameter="dc:location">
                  <field schema="advanced_search" name="zzz" />
                       "origin" : "52.3760, 4.894",
                       "ranges" : [
                          { "to" : 100 },
                          { "from" : 100, "to" : 300 },
                          { "from" : 300 }
              <whereClause docType="AdvancedSearch">
              <!-- sort column="dc:title" ascending="true" / sort by fulltext relevance -->
            <searchLayout name="advanced_search" />
            <aggregationLayout name="advanced_search_agg" />

      Aggregation Layout definition:

          <layout name="advanced_search_agg">
              <template mode="any">/layouts/layout_default_template.xhtml</template>
          <widget name="dc_coverage_agg_widget" type="manyCheckboxOrMultipleSelect2IfTooMany">
              <label mode="any">Select coverage</label>
            <properties mode="any">
              <property name="width">300</property>
              <property name="minChars">0</property>
              <property name="directoryName">l10ncoverage</property>
              <options value="#{aggregateFormatterBean.formatDirEntries('l10ncoverage',aggregates['dc_coverage_agg'])}"  var="item" itemValue="#{item.id}" itemLabel="#{item.label}" />


          Issue Links



              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created:

                  Time Tracking

                  Original Estimate - 1 week
                  Remaining Estimate - 1 week
                  Time Spent - Not Specified
                  Not Specified