Class ElasticSearchNxqlPageProvider
- All Implemented Interfaces:
Serializable,PageProvider<DocumentModel>
- Since:
- 5.9.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final longstatic final Stringprotected static final org.apache.logging.log4j.Loggerprotected Longstatic final StringFields inherited from class org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider
CHECK_QUERY_CACHE_PROPERTY, currentPageDocuments, DEFAULT_NAVIGATION_RESULTS_KEY, DEFAULT_NAVIGATION_RESULTS_PROPERTY, DEFAULT_NAVIGATION_RESULTS_VALUE, DETACH_DOCUMENTS_PROPERTY, MAX_RESULTS_PROPERTY, maxResults, PAGE_SIZE_RESULTS_KEY, query, USE_UNRESTRICTED_SESSION_PROPERTYFields inherited from class org.nuxeo.ecm.platform.query.api.AbstractPageProvider
currentEntryIndex, currentHigherNonEmptyPageIndex, currentSelectPage, definition, error, errorMessage, highlights, maxPageSize, name, offset, PAGEPROVIDER_TRACK_PROPERTY_NAME, pageProviderChangedListener, pageSize, pageSizeOptions, parameters, properties, quickFilters, resultsCount, searchDocumentModel, selectedEntries, SKIPPED_SCHEMAS_FOR_SEARCHFIELD, sortable, sortInfos, trackingFields inherited from interface org.nuxeo.ecm.platform.query.api.PageProvider
DEFAULT_MAX_PAGE_SIZE, DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP, HIGHLIGHT_CTX_DATA, PAGE_LIMIT_UNKNOWN, SKIP_AGGREGATES_PROP, UNKNOWN_SIZE, UNKNOWN_SIZE_AFTER_QUERY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation,? extends Bucket>> protected CoreSessionReturns the list of current page items.org.opensearch.index.query.QueryBuilderprotected intgetLimit()longReturns the max result window where the PP can navigate without raising Elasticsearch QueryPhaseExecutionException.longReturns the page limit.protected NxQueryBuildergetQueryBuilder(CoreSession session) longLimit of number of results beyond which the page provider may not be able to computePageProvider.getResultsCount()or navigate.booleanprotected voidincorporateAggregates(Map<String, Serializable> eventProps) Extends the default implementation to add results of aggregatesbooleanReturns a boolean expressing if the last page can be displayed.booleanReturns a boolean expressing if there are further pages.protected voidPage change hook, to override for custom behaviorvoidrefresh()Refresh hook, to override for custom behaviorprotected booleanvoidsetMaxResultWindow(long maxResultWindow) Set the max result window where the PP can navigate, for testing purpose.Methods inherited from class org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider
buildQuery, checkQueryCache, detachDocuments, getCurrentQuery, getCurrentSelectPage, getFilter, getMaxResults, rewindSelectablePage, setMaxResults, useUnrestrictedSessionMethods inherited from class org.nuxeo.ecm.platform.query.api.AbstractPageProvider
addQuickFilter, addSortInfo, fireSearchEvent, firstPage, getAggregateDefinitions, getAvailableQuickFilters, getBooleanProperty, getCurrentEntry, getCurrentHigherNonEmptyPageIndex, getCurrentPageIndex, getCurrentPageOffset, getCurrentPageSize, getCurrentPageStatus, getDefaultMaxPageSize, getDefinition, getError, getErrorMessage, getHighlights, getMaxNumberOfEmptyPages, getMaxPageSize, getMinMaxPageSize, getName, getNumberOfPages, getPageSize, getPageSizeOptions, getParameters, getParametersChanged, getProperties, getQuickFilters, getResultsCount, getSearchDocumentModel, getSortInfo, getSortInfoIndex, getSortInfos, hasChangedParameters, hasError, isNextEntryAvailable, isPreviousEntryAvailable, isPreviousPageAvailable, isSkipAggregates, isSortable, isTrackingEnabled, lastPage, nextEntry, nextPage, notifyPageChanged, notifyRefresh, previousEntry, previousPage, searchDocumentModelChanged, setCurrentEntry, setCurrentEntryIndex, setCurrentHigherNonEmptyPageIndex, setCurrentPage, setCurrentPageIndex, setCurrentPageOffset, setDefinition, setHighlights, setMaxPageSize, setName, setPageProviderChangedListener, setPageSize, setPageSizeOptions, setParameters, setProperties, setQuickFilters, setResultsCount, setSearchDocumentModel, setSelectedEntries, setSortable, setSortInfo, setSortInfo, setSortInfos, sortInfoChanged
-
Field Details
-
CORE_SESSION_PROPERTY
- See Also:
-
SEARCH_ON_ALL_REPOSITORIES_PROPERTY
- See Also:
-
ES_MAX_RESULT_WINDOW_PROPERTY
- See Also:
-
DEFAULT_ES_MAX_RESULT_WINDOW_VALUE
public static final long DEFAULT_ES_MAX_RESULT_WINDOW_VALUE- See Also:
-
log
protected static final org.apache.logging.log4j.Logger log -
currentAggregates
-
maxResultWindow
-
-
Constructor Details
-
ElasticSearchNxqlPageProvider
public ElasticSearchNxqlPageProvider()
-
-
Method Details
-
getCurrentPage
Description copied from class:AbstractPageProviderReturns the list of current page items.Custom implementation can be added here, based on the page provider properties, parameters and
WhereClauseDefinitionon thePageProviderDefinition, as well as search document, sort information, etc...Implementation of this method usually consists in setting a non-null value to a field caching current items, and nullifying this field by overriding
AbstractPageProvider.pageChanged()andAbstractPageProvider.refresh().Fields
AbstractPageProvider.errorMessageandAbstractPageProvider.errorcan also be filled to provide accurate feedback in case an error occurs during the search.When items are retrieved, a call to
AbstractPageProvider.setResultsCount(long)should be made to ensure proper pagination as implemented in this abstract class. The implementation inCoreQueryAndFetchPageProvideris a good example when the total results count is known.If for performance reasons, for instance, the number of results cannot be known, a fall-back strategy can be applied to provide the "next" button but not the "last" one, by calling
AbstractPageProvider.getCurrentHigherNonEmptyPageIndex()andAbstractPageProvider.setCurrentHigherNonEmptyPageIndex(int). In this case,CoreQueryDocumentPageProvideris a good example.- Specified by:
getCurrentPagein interfacePageProvider<DocumentModel>- Overrides:
getCurrentPagein classCoreQueryDocumentPageProvider- Returns:
- the current page
-
getLimit
protected int getLimit() -
getCurrentQueryAsEsBuilder
public org.opensearch.index.query.QueryBuilder getCurrentQueryAsEsBuilder() -
pageChanged
protected void pageChanged()Description copied from class:AbstractPageProviderPage change hook, to override for custom behaviorWhen overriding it, call
super.pageChanged()as last statement to make sure that thePageProviderChangedListeneris called with the up-to-date @{code PageProvider} state.- Overrides:
pageChangedin classCoreQueryDocumentPageProvider
-
refresh
public void refresh()Description copied from class:AbstractPageProviderRefresh hook, to override for custom behaviorWhen overriding it, call
super.refresh()as last statement to make sure that thePageProviderChangedListeneris called with the up-to-date @{code PageProvider} state.- Specified by:
refreshin interfacePageProvider<DocumentModel>- Overrides:
refreshin classCoreQueryDocumentPageProvider
-
getCoreSession
- Overrides:
getCoreSessionin classCoreQueryDocumentPageProvider
-
buildAggregates
protected List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation,? extends Bucket>> buildAggregates() -
searchOnAllRepositories
protected boolean searchOnAllRepositories() -
hasAggregateSupport
public boolean hasAggregateSupport()- Specified by:
hasAggregateSupportin interfacePageProvider<DocumentModel>- Overrides:
hasAggregateSupportin classAbstractPageProvider<DocumentModel>
-
getAggregates
- Specified by:
getAggregatesin interfacePageProvider<DocumentModel>- Overrides:
getAggregatesin classAbstractPageProvider<DocumentModel>
-
incorporateAggregates
Extends the default implementation to add results of aggregates- Overrides:
incorporateAggregatesin classAbstractPageProvider<DocumentModel>- Since:
- 7.4
-
isLastPageAvailable
public boolean isLastPageAvailable()Description copied from interface:PageProviderReturns a boolean expressing if the last page can be displayed.- Specified by:
isLastPageAvailablein interfacePageProvider<DocumentModel>- Overrides:
isLastPageAvailablein classAbstractPageProvider<DocumentModel>
-
isNextPageAvailable
public boolean isNextPageAvailable()Description copied from interface:PageProviderReturns a boolean expressing if there are further pages.- Specified by:
isNextPageAvailablein interfacePageProvider<DocumentModel>- Overrides:
isNextPageAvailablein classAbstractPageProvider<DocumentModel>
-
getPageLimit
public long getPageLimit()Description copied from class:CoreQueryDocumentPageProviderReturns the page limit. The n first page we know they exist. We don't compute the number of page beyond this limit.- Specified by:
getPageLimitin interfacePageProvider<DocumentModel>- Overrides:
getPageLimitin classCoreQueryDocumentPageProvider
-
getMaxResultWindow
public long getMaxResultWindow()Returns the max result window where the PP can navigate without raising Elasticsearch QueryPhaseExecutionException.from + sizemust be less than or equal to this value.- Since:
- 9.2
-
getResultsCountLimit
public long getResultsCountLimit()Description copied from interface:PageProviderLimit of number of results beyond which the page provider may not be able to computePageProvider.getResultsCount()or navigate.Requesting results beyond this limit may result in error. When
PageProvider.getResultsCount()is negative, it means there may be more results than this limit.0 means there is no limit.
- Specified by:
getResultsCountLimitin interfacePageProvider<DocumentModel>- Overrides:
getResultsCountLimitin classCoreQueryDocumentPageProvider
-
setMaxResultWindow
public void setMaxResultWindow(long maxResultWindow) Set the max result window where the PP can navigate, for testing purpose.- Since:
- 9.2
-
getQueryBuilder
- Since:
- 2021.11
-