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, wait
findAllDimensionRows, findFilteredDimensionRows, hasAnyRows, replaceIndex
public NoOpSearchProvider(int queryWeightLimit)
queryWeightLimit
- Weight limit for the query, used as a cardinality approximation for this dimensionpublic void setDimension(Dimension dimension)
SearchProvider
setDimension
in interface SearchProvider
dimension
- Dimension the SearchProvider is searchingpublic void setKeyValueStore(KeyValueStore keyValueStore)
SearchProvider
setKeyValueStore
in interface SearchProvider
keyValueStore
- 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 SearchProvider
public TreeSet<DimensionRow> findAllOrderedDimensionRows()
findAllOrderedDimensionRows
in interface SearchProvider
public void refreshIndex(String rowId, DimensionRow dimensionRow, DimensionRow dimensionRowOld)
SearchProvider
refreshIndex
in interface SearchProvider
rowId
- 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)
SearchProvider
refreshIndex
in interface SearchProvider
changedRows
- 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()
SearchProvider
clearDimension
in interface SearchProvider
public boolean isHealthy()
SearchProvider
isHealthy
in interface SearchProvider
public Pagination<DimensionRow> findAllDimensionRowsPaged(PaginationParameters paginationParameters)
SearchProvider
findAllDimensionRowsPaged
in interface SearchProvider
paginationParameters
- 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)
SearchProvider
findFilteredDimensionRowsPaged
in interface SearchProvider
filters
- 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.