public class CachingFederationStrategy extends Object implements FederationStrategy, PostIngestPlugin
FederationStrategy
based on sorting Metacard
s. The sorting is based on the Query
's
SortBy
propertyName. The possible sorting values are
The supported ordering includes SortOrder.DESCENDING
and SortOrder.ASCENDING
. For this class to function properly a sort value
and sort order must be provided.Modifier and Type | Field and Description |
---|---|
protected static String |
CACHE_QUERY_MODE
Query the cache
|
protected static Comparator<Result> |
DEFAULT_COMPARATOR
The default comparator for sorting by
Result.RELEVANCE , SortOrder.DESCENDING |
protected static String |
INDEX_QUERY_MODE
Query and update the cache but block until done indexing
|
protected static String |
NATIVE_QUERY_MODE
Query without updating the cache
|
protected List<PostFederatedQueryPlugin> |
postQuery
|
protected List<PreFederatedQueryPlugin> |
preQuery
|
protected static String |
QUERY_MODE |
protected static String |
UPDATE_QUERY_MODE
Query and update the cache without blocking
|
Constructor and Description |
---|
CachingFederationStrategy(ExecutorService queryExecutorService,
List<PreFederatedQueryPlugin> preQuery,
List<PostFederatedQueryPlugin> postQuery,
SolrCache cache,
ExecutorService cacheExecutorService,
ValidationQueryFactory validationQueryFactory,
CacheQueryFactory cacheQueryFactory)
Instantiates an
AbstractFederationStrategy with the provided ExecutorService . |
Modifier and Type | Method and Description |
---|---|
QueryResponse |
federate(List<Source> sources,
QueryRequest queryRequest)
Federate the given query to the
List of Source s, returning a QueryResponse back to the user that will include the matching Result s. |
boolean |
getShowErrors() |
boolean |
getShowWarnings() |
boolean |
isCacheRemoteIngests() |
CreateResponse |
process(CreateResponse input)
Processes the
CreateResponse . |
DeleteResponse |
process(DeleteResponse input)
Processes the
DeleteResponse . |
UpdateResponse |
process(UpdateResponse input)
Processes the
UpdateResponse . |
void |
setCacheRemoteIngests(boolean cacheRemoteIngests) |
void |
setCacheStrategy(String cacheStrategy)
Phaser that forces all added metacards to commit to the cache on phase advance
|
void |
setCachingEverything(boolean cachingEverything) |
void |
setExpirationAgeInMinutes(long expirationAgeInMinutes) |
void |
setExpirationIntervalInMinutes(long expirationIntervalInMinutes) |
void |
setMaxStartIndex(int maxStartIndex)
To be set via Spring/Blueprint
|
void |
setShowErrors(boolean showErrors) |
void |
setShowWarnings(boolean showWarnings) |
void |
shutdown() |
protected static final Comparator<Result> DEFAULT_COMPARATOR
Result.RELEVANCE
, SortOrder.DESCENDING
protected static final String QUERY_MODE
protected static final String CACHE_QUERY_MODE
protected static final String NATIVE_QUERY_MODE
protected static final String INDEX_QUERY_MODE
protected static final String UPDATE_QUERY_MODE
protected List<PreFederatedQueryPlugin> preQuery
protected List<PostFederatedQueryPlugin> postQuery
public CachingFederationStrategy(ExecutorService queryExecutorService, List<PreFederatedQueryPlugin> preQuery, List<PostFederatedQueryPlugin> postQuery, SolrCache cache, ExecutorService cacheExecutorService, ValidationQueryFactory validationQueryFactory, CacheQueryFactory cacheQueryFactory)
AbstractFederationStrategy
with the provided ExecutorService
.queryExecutorService
- the ExecutorService
for queriespublic QueryResponse federate(List<Source> sources, QueryRequest queryRequest)
FederationStrategy
List
of Source
s, returning a QueryResponse
back to the user that will include the matching Result
s.federate
in interface FederationStrategy
sources
- the List
of Source
s to be queried. Cannot be null
or
empty.queryRequest
- the QueryRequest
to execute. Cannot be null
.QueryResponse
which contains the list of Result
s.public CreateResponse process(CreateResponse input) throws PluginExecutionException
PostIngestPlugin
CreateResponse
.process
in interface PostIngestPlugin
input
- the CreateResponse
to processCreateResponse
to pass to the next PostIngestPlugin
, or if this is the last PostIngestPlugin
to be calledPluginExecutionException
- thrown when an error occurs during processingpublic UpdateResponse process(UpdateResponse input) throws PluginExecutionException
PostIngestPlugin
UpdateResponse
.process
in interface PostIngestPlugin
input
- the UpdateResponse
to processUpdateResponse
to pass to the next PostIngestPlugin
, or if this is the last PostIngestPlugin
to be calledPluginExecutionException
- thrown when an error occurs during processingpublic DeleteResponse process(DeleteResponse input) throws PluginExecutionException
PostIngestPlugin
DeleteResponse
.process
in interface PostIngestPlugin
input
- the DeleteResponse
to processDeleteResponse
to pass to the next PostIngestPlugin
, or if this is the last PostIngestPlugin
to be calledPluginExecutionException
- thrown when an error occurs during processingpublic void setMaxStartIndex(int maxStartIndex)
maxStartIndex
- the new default max start index valuepublic void setExpirationIntervalInMinutes(long expirationIntervalInMinutes)
public void setExpirationAgeInMinutes(long expirationAgeInMinutes)
public void setCachingEverything(boolean cachingEverything)
public boolean isCacheRemoteIngests()
public void setCacheRemoteIngests(boolean cacheRemoteIngests)
public void shutdown()
public boolean getShowErrors()
public void setShowErrors(boolean showErrors)
public boolean getShowWarnings()
public void setShowWarnings(boolean showWarnings)
public void setCacheStrategy(String cacheStrategy)
This work is licensed under a Creative Commons Attribution 4.0 International License.