Class ElasticSearchNxqlPageProvider
- All Implemented Interfaces:
Serializable
,PageProvider<DocumentModel>
- Since:
- 5.9.3
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final long
static final String
protected static final org.apache.logging.log4j.Logger
protected Long
static final String
Fields 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_PROPERTY
Fields 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, tracking
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation,
? extends Bucket>> protected CoreSession
Returns the list of current page items.org.opensearch.index.query.QueryBuilder
protected int
getLimit()
long
Returns the max result window where the PP can navigate without raising Elasticsearch QueryPhaseExecutionException.long
Returns the page limit.protected NxQueryBuilder
getQueryBuilder
(CoreSession session) long
Limit of number of results beyond which the page provider may not be able to computePageProvider.getResultsCount()
or navigate.boolean
protected void
incorporateAggregates
(Map<String, Serializable> eventProps) Extends the default implementation to add results of aggregatesboolean
Returns a boolean expressing if the last page can be displayed.boolean
Returns a boolean expressing if there are further pages.protected void
Page change hook, to override for custom behaviorvoid
refresh()
Refresh hook, to override for custom behaviorprotected boolean
void
setMaxResultWindow
(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, useUnrestrictedSession
Methods 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:AbstractPageProvider
Returns the list of current page items.Custom implementation can be added here, based on the page provider properties, parameters and
WhereClauseDefinition
on 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.errorMessage
andAbstractPageProvider.error
can 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 inCoreQueryAndFetchPageProvider
is 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,CoreQueryDocumentPageProvider
is a good example.- Specified by:
getCurrentPage
in interfacePageProvider<DocumentModel>
- Overrides:
getCurrentPage
in 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:AbstractPageProvider
Page change hook, to override for custom behaviorWhen overriding it, call
super.pageChanged()
as last statement to make sure that thePageProviderChangedListener
is called with the up-to-date @{code PageProvider} state.- Overrides:
pageChanged
in classCoreQueryDocumentPageProvider
-
refresh
public void refresh()Description copied from class:AbstractPageProvider
Refresh hook, to override for custom behaviorWhen overriding it, call
super.refresh()
as last statement to make sure that thePageProviderChangedListener
is called with the up-to-date @{code PageProvider} state.- Specified by:
refresh
in interfacePageProvider<DocumentModel>
- Overrides:
refresh
in classCoreQueryDocumentPageProvider
-
getCoreSession
- Overrides:
getCoreSession
in classCoreQueryDocumentPageProvider
-
buildAggregates
protected List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation,? extends Bucket>> buildAggregates() -
searchOnAllRepositories
protected boolean searchOnAllRepositories() -
hasAggregateSupport
public boolean hasAggregateSupport()- Specified by:
hasAggregateSupport
in interfacePageProvider<DocumentModel>
- Overrides:
hasAggregateSupport
in classAbstractPageProvider<DocumentModel>
-
getAggregates
- Specified by:
getAggregates
in interfacePageProvider<DocumentModel>
- Overrides:
getAggregates
in classAbstractPageProvider<DocumentModel>
-
incorporateAggregates
Extends the default implementation to add results of aggregates- Overrides:
incorporateAggregates
in classAbstractPageProvider<DocumentModel>
- Since:
- 7.4
-
isLastPageAvailable
public boolean isLastPageAvailable()Description copied from interface:PageProvider
Returns a boolean expressing if the last page can be displayed.- Specified by:
isLastPageAvailable
in interfacePageProvider<DocumentModel>
- Overrides:
isLastPageAvailable
in classAbstractPageProvider<DocumentModel>
-
isNextPageAvailable
public boolean isNextPageAvailable()Description copied from interface:PageProvider
Returns a boolean expressing if there are further pages.- Specified by:
isNextPageAvailable
in interfacePageProvider<DocumentModel>
- Overrides:
isNextPageAvailable
in classAbstractPageProvider<DocumentModel>
-
getPageLimit
public long getPageLimit()Description copied from class:CoreQueryDocumentPageProvider
Returns the page limit. The n first page we know they exist. We don't compute the number of page beyond this limit.- Specified by:
getPageLimit
in interfacePageProvider<DocumentModel>
- Overrides:
getPageLimit
in classCoreQueryDocumentPageProvider
-
getMaxResultWindow
public long getMaxResultWindow()Returns the max result window where the PP can navigate without raising Elasticsearch QueryPhaseExecutionException.from + size
must be less than or equal to this value.- Since:
- 9.2
-
getResultsCountLimit
public long getResultsCountLimit()Description copied from interface:PageProvider
Limit 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:
getResultsCountLimit
in interfacePageProvider<DocumentModel>
- Overrides:
getResultsCountLimit
in 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
-