public class NoOpSearchProvider extends Object implements SearchProvider
This class is for supporting search dimensions which don't have any defined set of dimension rows The find* method's on this class would not throw an exception if the filterValue is not found, instead it would just return a new dimension row matching the filter.
| Constructor and Description |
|---|
NoOpSearchProvider(int queryWeightLimit)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearDimension()
Clears the dimension cache, and resets the indices, effectively resetting the SearchProvider to a clean state.
|
Pagination<DimensionRow> |
findAllDimensionRowsPaged(PaginationParameters paginationParameters)
Return the desired page of dimension rows.
|
TreeSet<DimensionRow> |
findAllOrderedDimensionRows()
For dimensions with NoOpSearchProvider, the dimension rows are unknown.
|
Pagination<DimensionRow> |
findFilteredDimensionRowsPaged(Set<ApiFilter> filters,
PaginationParameters paginationParameters)
Return the desired page of dimension rows that match the specified filters.
|
int |
getDimensionCardinality()
Get cardinality for the dimension
|
boolean |
isHealthy()
Method to check if search provider is healthy.
|
void |
refreshIndex(Map<String,HashDataCache.Pair<DimensionRow,DimensionRow>> changedRows)
Method to add / update indexes.
|
void |
refreshIndex(String rowId,
DimensionRow dimensionRow,
DimensionRow dimensionRowOld)
Method to add / update indexes.
|
void |
setDimension(Dimension dimension)
Setter for dimension.
|
void |
setKeyValueStore(KeyValueStore keyValueStore)
Setter for store.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindAllDimensionRows, findFilteredDimensionRows, hasAnyRows, replaceIndexpublic NoOpSearchProvider(int queryWeightLimit)
queryWeightLimit - Weight limit for the query, used as a cardinality approximation for this dimensionpublic void setDimension(Dimension dimension)
SearchProvidersetDimension in interface SearchProviderdimension - Dimension the SearchProvider is searchingpublic void setKeyValueStore(KeyValueStore keyValueStore)
SearchProvidersetKeyValueStore in interface SearchProviderkeyValueStore - KeyValueStore that holds the data rows indexed by the Search Providerpublic int getDimensionCardinality()
For dimensions with NoOpSearchProvider, cardinality is unknown because it doesn't have defined set of dimension rows. For such dimensions we should always calculate the query weight and if query weight is larger than what is configured as package_name__query_weight_limit, the query weight is computed always otherwise it is skipped.
Hence, returning the cardinality value as package_name__query_weight_limit
getDimensionCardinality in interface SearchProviderpublic TreeSet<DimensionRow> findAllOrderedDimensionRows()
findAllOrderedDimensionRows in interface SearchProviderpublic void refreshIndex(String rowId, DimensionRow dimensionRow, DimensionRow dimensionRowOld)
SearchProviderrefreshIndex in interface SearchProviderrowId - Unique ID for the dimension rowdimensionRow - New, updated dimension rowdimensionRowOld - Old dimension row if we're updating one, or null if there is no row for the rowIdpublic void refreshIndex(Map<String,HashDataCache.Pair<DimensionRow,DimensionRow>> changedRows)
SearchProviderrefreshIndex in interface SearchProviderchangedRows - Collection of newRow / oldRow pairs keyed by rowId to update the index with. Each row is a
pair of dimension rows (newRow is the key, oldRow is the value), with the rowId (ie. unique key in the dimension)
as the top-level Map key.public void clearDimension()
SearchProviderclearDimension in interface SearchProviderpublic boolean isHealthy()
SearchProviderisHealthy in interface SearchProviderpublic Pagination<DimensionRow> findAllDimensionRowsPaged(PaginationParameters paginationParameters)
SearchProviderfindAllDimensionRowsPaged in interface SearchProviderpaginationParameters - The parameters that define a page (i.e. the number of rows per page,
and the page of results desired)public Pagination<DimensionRow> findFilteredDimensionRowsPaged(Set<ApiFilter> filters, PaginationParameters paginationParameters)
SearchProviderfindFilteredDimensionRowsPaged in interface SearchProviderfilters - ApiFilters to use for finding matching dimension rowspaginationParameters - The parameters that define a page (i.e. the number of rows per page,
and the page of results desired)
Throws TimeoutException If the search times out.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.