Class Engine


  • public class Engine
    extends Object
    Faceted browsing engine. Given a Grid and facet configurations, it can be used to compute facet statistics and obtain a filtered view of the grid according to the facets.
    It also computes datatype statistics for each column, serialized in the "columnStats" JSON field.
    • Constructor Detail

    • Method Detail

      • getGrid

        public Grid getGrid()
      • getFacetResults

        public com.google.common.collect.ImmutableList<FacetResult> getFacetResults()
        The state of the computed facets.
      • isNeutral

        public boolean isNeutral()
        True when all the facets are in a neutral state, meaning that they do not filter out any row or record.
      • getColumnStats

        public List<ColumnStats> getColumnStats()
        Some statistics for each column: reconciliation and data type statistics.
      • getTotalCount

        public long getTotalCount()
        Total number of rows/records in the unfiltered grid
      • getTotalRows

        public long getTotalRows()
        Total number of rows in the unfiltered grid (needed to provide a link to the last page)
      • getAggregatedCount

        public long getAggregatedCount()
        Number of rows on which the facets were actually checked. Can be less than getTotalCount() if the engine configuration capped the number of rows to process.
      • getFilteredCount

        public long getFilteredCount()
        Number of rows in the filtered grid, among those which have been checked (getAggregatedCount()).
      • limitReached

        public boolean limitReached()
        True when the aggregation stopped because of the imposed aggregation limit, in which case statistics such as getFilteredCount() should be understood relative to getAggregatedCount().
      • getMatchingRows

        public CloseableIterator<IndexedRow> getMatchingRows​(SortingConfig sortingConfig)
        Iterates over the rows matched by the given filters. If the engine is in records mode, the rows corresponding to the matching records are returned.
        Parameters:
        sortingConfig - in which order to iterate over rows
      • getMatchingRecords

        public CloseableIterator<Record> getMatchingRecords​(SortingConfig sortingConfig)
        Iterates over the records matched by the given filters. If the engine is in records mode, the rows corresponding to the matching records are returned.
        Parameters:
        sortingConfig - in which order to iterate over records
      • combinedRowFilters

        public RowFilter combinedRowFilters()
        Returns:
        a row filter obtained from all applied facets
      • combinedRecordFilters

        public RecordFilter combinedRecordFilters()
        Returns:
        a record filter obtained from all applied facets
      • aggregateFilteredRows

        public <T extends Serializable> T aggregateFilteredRows​(RowAggregator<T> aggregator,
                                                                T initialState)
        Runs an aggregator only on the rows that are selected by facets.
        Parameters:
        aggregator - the aggregator to run on the selected rows
        initialState - the initial state of the aggregator (which should act as neutral element)
      • aggregateFilteredRecords

        public <T extends Serializable> T aggregateFilteredRecords​(RecordAggregator<T> aggregator,
                                                                   T initialState)
        Runs an aggregator only on the records that are selected by facets.
        Parameters:
        aggregator - the aggregator to run on the selected records
        initialState - the initial state of the aggregator (which should act as neutral element)