public abstract class VespaBackEndSearcher extends PingableSearcher
Modifier and Type | Field and Description |
---|---|
protected CacheControl |
cacheControl
Cache wrapper
|
private static com.yahoo.processing.request.CompoundName |
combinerows |
private String |
defaultDocsumClass
Default docsum class.
|
private DocumentDatabase |
defaultDocumentDb |
private static com.yahoo.processing.request.CompoundName |
dispatchSummaries
If this is turned on this will fill summaries by dispatching directly to search nodes over RPC
|
private Map<String,DocumentDatabase> |
documentDbs
The set of all document databases available in the backend handled by this searcher
|
private static com.yahoo.processing.request.CompoundName |
grouping |
private boolean |
localDispatching |
private String |
name
The name of this source
|
protected static com.yahoo.processing.request.CompoundName |
PACKET_COMPRESSION_LIMIT |
protected static com.yahoo.processing.request.CompoundName |
PACKET_COMPRESSION_TYPE |
private int |
rowBits
The number of last significant bits in the partId which specifies the
row number in this backend,
the rest specifies the column.
|
private int |
sourceNumber
Searchcluster number
|
protected static com.yahoo.processing.request.CompoundName |
TRACE_DISABLE |
Constructor and Description |
---|
VespaBackEndSearcher() |
Modifier and Type | Method and Description |
---|---|
private boolean |
addCachedHits(Result result,
PacketWrapper packetWrapper,
String summaryClass,
List<DocumentInfo> documents) |
protected void |
addMetaInfo(Query query,
QueryPacketData queryPacketData,
QueryResultPacket resultPacket,
Result result,
boolean fromCache) |
protected boolean |
addUnfilledHits(Result result,
List<DocumentInfo> documents,
boolean fromCache,
QueryPacketData queryPacketData,
CacheKey cacheKey)
Creates unfilled hits from a List of DocumentInfo instances.
|
private Result |
cacheLookupFirstPhase(CacheKey key,
QueryPacketData queryPacketData,
Query query,
int offset,
int hits,
String summaryClass) |
protected PacketWrapper |
cacheLookupTwoPhase(CacheKey cacheKey,
Result result,
String summaryClass) |
private void |
decodeSummary(String summaryClass,
FastHit hit,
byte[] docsumdata) |
private void |
decodeSummary(String summaryClass,
FastHit hit,
byte[] docsumdata,
DocsumDefinitionSet docsumSet) |
protected abstract void |
doPartialFill(Result result,
String summaryClass) |
protected abstract Result |
doSearch2(Query query,
QueryPacket queryPacket,
CacheKey cacheKey,
Execution execution)
Searches a search cluster
This is an endpoint - searchers will never propagate the search to any nested searcher.
|
protected static void |
ensureInstanceOf(Class<? extends BasicPacket> type,
BasicPacket packet,
String name)
Throws an IOException if the packet is not of the expected type
|
private void |
extractDocumentInfo(FastHit hit,
DocumentInfo document) |
void |
fill(Result result,
String summaryClass,
Execution execution)
Fill hit properties with data using the given summary class.
|
private boolean |
fillHit(FastHit hit,
DocsumPacket packet,
String summaryClass) |
protected int |
fillHits(Result result,
int packetIndex,
Packet[] packets,
String summaryClass)
Fills the hits.
|
CacheControl |
getCacheControl()
Returns the packet cache controller of this
|
private Result |
getCached(CacheKey cacheKey,
QueryPacketData queryPacketData,
Query query)
Returns a cached result, or null if no result was cached for this key
|
protected String |
getDefaultDocsumClass() |
protected DocsumDefinitionSet |
getDocsumDefinitionSet(Query query) |
protected DocumentDatabase |
getDocumentDatabase(Query query) |
protected String |
getName() |
static VespaBackEndSearcher |
getSearcher(String s) |
protected Iterator<Hit> |
hitIterator(Result result)
Returns an iterator which returns all hits below this result
|
void |
init(SummaryParameters docSumParams,
ClusterParams clusterParams,
CacheParams cacheParams,
DocumentdbInfoConfig documentdbInfoConfig) |
boolean |
isLocalDispatching() |
protected boolean |
isLoggingFine() |
private void |
mergeErrorsInto(Result destination,
Result source) |
private List<Result> |
partitionHits(Result result,
String summaryClass) |
private void |
resolveDocumentDatabase(Query query) |
Result |
search(Query query,
Execution execution)
Override this to implement your searcher.
|
private void |
setDefaultDocsumClass(String docsumClass)
Sets default document summary class.
|
void |
setLocalDispatching(boolean localDispatching) |
protected boolean |
summaryNeedsQuery(Query query)
Returns whether we need to send the query when fetching summaries.
|
(package private) static void |
traceQuery(String sourceName,
String type,
Query query,
int offset,
int hits,
int level,
Optional<String> quotedSummaryClass) |
protected void |
transformQuery(Query query) |
private boolean |
useRowInIndexUri(Result result) |
protected static boolean |
wantsRPCSummaryFill(Query query) |
ping
ensureFilled, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
private static final com.yahoo.processing.request.CompoundName grouping
private static final com.yahoo.processing.request.CompoundName combinerows
private static final com.yahoo.processing.request.CompoundName dispatchSummaries
protected static final com.yahoo.processing.request.CompoundName PACKET_COMPRESSION_LIMIT
protected static final com.yahoo.processing.request.CompoundName PACKET_COMPRESSION_TYPE
protected static final com.yahoo.processing.request.CompoundName TRACE_DISABLE
private Map<String,DocumentDatabase> documentDbs
private DocumentDatabase defaultDocumentDb
private String defaultDocsumClass
private boolean localDispatching
private String name
protected CacheControl cacheControl
private int rowBits
private int sourceNumber
protected Iterator<Hit> hitIterator(Result result)
protected final String getName()
protected final String getDefaultDocsumClass()
private void setDefaultDocsumClass(String docsumClass)
public final CacheControl getCacheControl()
protected abstract Result doSearch2(Query query, QueryPacket queryPacket, CacheKey cacheKey, Execution execution)
query
- the query to searchqueryPacket
- the serialized query representation to pass to the search clustercacheKey
- the cache key created from the query packet, or null if caching is not usedexecution
- the query execution contextprotected static boolean wantsRPCSummaryFill(Query query)
protected boolean summaryNeedsQuery(Query query)
private Result cacheLookupFirstPhase(CacheKey key, QueryPacketData queryPacketData, Query query, int offset, int hits, String summaryClass) throws IOException
IOException
protected DocumentDatabase getDocumentDatabase(Query query)
private void resolveDocumentDatabase(Query query)
public final void init(SummaryParameters docSumParams, ClusterParams clusterParams, CacheParams cacheParams, DocumentdbInfoConfig documentdbInfoConfig)
protected void transformQuery(Query query)
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 Result getCached(CacheKey cacheKey, QueryPacketData queryPacketData, Query query)
cacheKey
- the cache key created from the query packetqueryPacketData
- a serialization of the query, to avoid having to recompute this, or null if not availablequery
- the query, used for tracing, lookup of result window and result creationpublic 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.
static void traceQuery(String sourceName, String type, Query query, int offset, int hits, int level, Optional<String> quotedSummaryClass)
protected void addMetaInfo(Query query, QueryPacketData queryPacketData, QueryResultPacket resultPacket, Result result, boolean fromCache)
private boolean fillHit(FastHit hit, DocsumPacket packet, String summaryClass)
protected int fillHits(Result result, int packetIndex, Packet[] packets, String summaryClass) throws IOException
IOException
protected static void ensureInstanceOf(Class<? extends BasicPacket> type, BasicPacket packet, String name) throws IOException
IOException
private boolean addCachedHits(Result result, PacketWrapper packetWrapper, String summaryClass, List<DocumentInfo> documents)
private boolean useRowInIndexUri(Result result)
private void extractDocumentInfo(FastHit hit, DocumentInfo document)
protected PacketWrapper cacheLookupTwoPhase(CacheKey cacheKey, Result result, String summaryClass)
protected DocsumDefinitionSet getDocsumDefinitionSet(Query query)
private void decodeSummary(String summaryClass, FastHit hit, byte[] docsumdata, DocsumDefinitionSet docsumSet)
protected boolean addUnfilledHits(Result result, List<DocumentInfo> documents, boolean fromCache, QueryPacketData queryPacketData, CacheKey cacheKey)
queryPacketData
- binary data from first phase of search, or nullcacheKey
- the key this hit should match in the packet cache, or nullpublic static VespaBackEndSearcher getSearcher(String s)
protected boolean isLoggingFine()
public boolean isLocalDispatching()
public void setLocalDispatching(boolean localDispatching)
Copyright © 2017. All rights reserved.