public class ClusterSearcher extends Searcher
Modifier and Type | Class and Description |
---|---|
private class |
ClusterSearcher.Pinger |
Modifier and Type | Field and Description |
---|---|
private List<Backend> |
backends |
private com.yahoo.statistics.Value |
cacheHitRatio |
private String |
clusterModelName |
private static long |
DEFAULT_MAX_QUERY_CACHE_TIMEOUT |
private static long |
DEFAULT_MAX_QUERY_TIMEOUT |
private Set<String> |
documentTypes |
private boolean |
failoverToRemote |
private FS4ResourcePool |
fs4ResourcePool |
private Hasher |
hasher |
private static Logger |
log |
private long |
maxQueryCacheTimeout |
private long |
maxQueryTimeout |
private ClusterMonitor |
monitor |
private Map<String,Set<String>> |
rankProfiles |
Constructor and Description |
---|
ClusterSearcher(com.yahoo.component.ComponentId id,
com.yahoo.container.QrSearchersConfig qrsConfig,
ClusterConfig clusterConfig,
DocumentdbInfoConfig documentDbConfig,
LegacyEmulationConfig emulationConfig,
QrMonitorConfig monitorConfig,
com.yahoo.vespa.config.search.DispatchConfig dispatchConfig,
com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig,
com.yahoo.statistics.Statistics manager,
FS4ResourcePool fs4ResourcePool,
com.yahoo.container.handler.VipStatus vipStatus)
Creates a new ClusterSearcher.
|
ClusterSearcher(Set<String> documentTypes)
Do not use, for internal testing purposes only.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addBackendSearcher(VespaBackEndSearcher searcher) |
(package private) void |
addValidRankProfile(String profileName,
String docTypeName) |
private boolean |
backendCanServeDocuments(Pong pong) |
private void |
cacheHit() |
private void |
cacheMiss() |
private Result |
checkValidRankProfiles(Query query,
Set<String> docTypes)
Returns an error if the document types do not have the requested rank
profile.
|
private Backend |
createBackend(com.yahoo.container.QrSearchersConfig.Searchcluster.Dispatcher disp) |
private static CacheControl |
createCache(ClusterConfig config,
String clusterModelName) |
private List<Query> |
createQueries(Query query,
Set<String> docTypes) |
void |
deconstruct() |
void |
doFill(Searcher searcher,
Result result,
String summaryClass,
Execution execution) |
private Result |
doSearch(Searcher searcher,
Query query,
Execution execution) |
void |
dumpPackets(PacketDumper.PacketType packetType,
boolean on) |
(package private) void |
failed(VespaBackEndSearcher node)
Called from ClusterMonitor.
|
void |
fill(Result result,
String summaryClass,
Execution execution)
Fill hit properties with data using the given summary class.
|
private Set<String> |
filterValidDocumentTypes(Collection<String> restrict) |
Map<String,Backend.BackendStatistics> |
getBackendStatistics() |
String |
getClusterModelName() |
(package private) ExecutorService |
getExecutor() |
(package private) ClusterMonitor |
getMonitor() |
(package private) ScheduledExecutorService |
getScheduledExecutor() |
private static com.yahoo.container.QrSearchersConfig.Searchcluster |
getSearchClusterConfigFromClusterName(com.yahoo.container.QrSearchersConfig config,
String name) |
(package private) boolean |
isRemote(String host)
Returns false if this host is local.
|
private static ClusterParams |
makeClusterParams(int searchclusterIndex,
com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig,
LegacyEmulationConfig emulConfig,
int dispatchIndex) |
(package private) void |
ping(VespaBackEndSearcher node)
Pinging a node, called from ClusterMonitor.
|
(package private) Set<String> |
resolveDocumentTypes(Query query,
IndexFacts indexFacts) |
Result |
search(Query query,
Execution execution)
Override this to implement your searcher.
|
private static FastSearcher |
searchDispatch(int searchclusterIndex,
FS4ResourcePool fs4ResourcePool,
com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig,
CacheParams cacheParams,
LegacyEmulationConfig emulConfig,
SummaryParameters docSumParams,
DocumentdbInfoConfig documentdbInfoConfig,
Backend backend,
Dispatcher dispatcher,
int dispatcherIndex) |
private Result |
searchMultipleDocumentTypes(Searcher searcher,
Query query,
Execution execution) |
(package private) void |
setValidRankProfile(String profileName,
Set<String> documentTypes) |
private void |
updateCacheHitRatio(Result result,
Query query) |
private void |
validateQueryCache(Query query) |
private void |
validateQueryTimeout(Query query) |
private static VdsStreamingSearcher |
vdsCluster(int searchclusterIndex,
com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig,
CacheParams cacheParams,
LegacyEmulationConfig emulConfig,
SummaryParameters docSumParams,
DocumentdbInfoConfig documentdbInfoConfig) |
(package private) void |
working(VespaBackEndSearcher node)
NodeManager method, called from ClusterMonitor.
|
ensureFilled, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
private static final Logger log
private final ClusterMonitor monitor
private final Hasher hasher
private final com.yahoo.statistics.Value cacheHitRatio
private final String clusterModelName
private final boolean failoverToRemote
private final FS4ResourcePool fs4ResourcePool
private final long maxQueryTimeout
private static final long DEFAULT_MAX_QUERY_TIMEOUT
private final long maxQueryCacheTimeout
private static final long DEFAULT_MAX_QUERY_CACHE_TIMEOUT
public ClusterSearcher(com.yahoo.component.ComponentId id, com.yahoo.container.QrSearchersConfig qrsConfig, ClusterConfig clusterConfig, DocumentdbInfoConfig documentDbConfig, LegacyEmulationConfig emulationConfig, QrMonitorConfig monitorConfig, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig, com.yahoo.statistics.Statistics manager, FS4ResourcePool fs4ResourcePool, com.yahoo.container.handler.VipStatus vipStatus)
private static com.yahoo.container.QrSearchersConfig.Searchcluster getSearchClusterConfigFromClusterName(com.yahoo.container.QrSearchersConfig config, String name)
boolean isRemote(String host) throws UnknownHostException
UnknownHostException
private static ClusterParams makeClusterParams(int searchclusterIndex, com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig, LegacyEmulationConfig emulConfig, int dispatchIndex)
private static FastSearcher searchDispatch(int searchclusterIndex, FS4ResourcePool fs4ResourcePool, com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig, CacheParams cacheParams, LegacyEmulationConfig emulConfig, SummaryParameters docSumParams, DocumentdbInfoConfig documentdbInfoConfig, Backend backend, Dispatcher dispatcher, int dispatcherIndex)
private static VdsStreamingSearcher vdsCluster(int searchclusterIndex, com.yahoo.container.QrSearchersConfig.Searchcluster searchClusterConfig, CacheParams cacheParams, LegacyEmulationConfig emulConfig, SummaryParameters docSumParams, DocumentdbInfoConfig documentdbInfoConfig)
public Map<String,Backend.BackendStatistics> getBackendStatistics()
private Backend createBackend(com.yahoo.container.QrSearchersConfig.Searchcluster.Dispatcher disp)
private static CacheControl createCache(ClusterConfig config, String clusterModelName)
public String getClusterModelName()
ClusterMonitor getMonitor()
void addBackendSearcher(VespaBackEndSearcher searcher)
private Result checkValidRankProfiles(Query query, Set<String> docTypes)
query
- querydocTypes
- set of requested doc types for this querypublic void fill(Result result, String summaryClass, Execution execution)
Searcher
This needs to be overridden by federating searchers to contact search sources again by propagating the fill call down through the search chain, and by source searchers which talks to fill capable backends to request the data to be filled. Other searchers do not need to override this.
public void doFill(Searcher searcher, Result result, String summaryClass, Execution execution)
public Result search(Query query, Execution execution)
Searcher
Searcher implementation subclasses will, depending on their type of logic, do one of the following:
Hits come in two kinds - concrete hits are actual content of the kind requested by the user, meta hits are hits which provides information about the collection of hits, on the query, the service and so on.
The query specifies a window into a larger result list that must be returned from the searcher through hits and offset; Searchers which returns list of hits in the top level in the result must return at least hits number of hits (or if impossible; all that are available), starting at the given offset. In addition, searchers are allowed to return any number of meta hits (although this number is expected to be low). For hits contained in nested hit groups, the concept of a window defined by hits and offset is not well defined and does not apply.
Error handling in searchers:
private void validateQueryTimeout(Query query)
private void validateQueryCache(Query query)
private Result searchMultipleDocumentTypes(Searcher searcher, Query query, Execution execution)
Set<String> resolveDocumentTypes(Query query, IndexFacts indexFacts)
private Set<String> filterValidDocumentTypes(Collection<String> restrict)
private void cacheHit()
private void cacheMiss()
void working(VespaBackEndSearcher node)
void failed(VespaBackEndSearcher node)
void ping(VespaBackEndSearcher node) throws InterruptedException
InterruptedException
private boolean backendCanServeDocuments(Pong pong)
public void dumpPackets(PacketDumper.PacketType packetType, boolean on) throws IOException
IOException
public void deconstruct()
deconstruct
in class com.yahoo.component.AbstractComponent
ExecutorService getExecutor()
ScheduledExecutorService getScheduledExecutor()
Copyright © 2017. All rights reserved.