Class RealTimeGetComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- org.apache.solr.handler.component.RealTimeGetComponent
-
- All Implemented Interfaces:
SolrInfoBean,NamedListInitializedPlugin
public class RealTimeGetComponent extends SearchComponent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRealTimeGetComponent.ResolutionLookup strategy forgetInputDocument(SolrCore, BytesRef, AtomicLong, Set, Resolution).-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_NAMEstatic SolrInputDocumentDELETED-
Fields inherited from class org.apache.solr.handler.component.SearchComponent
metricNames, registry, standard_components
-
-
Constructor Summary
Constructors Constructor Description RealTimeGetComponent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcreateSubRequests(ResponseBuilder rb)intdistributedProcess(ResponseBuilder rb)Process for a distributed search.voidfinishStage(ResponseBuilder rb)private void handleRegularResponses(ResponseBuilder rb, ShardRequest sreq) { }SolrInfoBean.CategorygetCategory()Category of this componentStringgetDescription()Simple one or two line descriptionstatic SolrInputDocumentgetInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseNonStoredDVs, RealTimeGetComponent.Resolution resolveStrategy)Obtains the latest document for a given id from the tlog or through the realtime searcher (if not found in the tlog).static SolrInputDocumentgetInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, RealTimeGetComponent.Resolution lookupStrategy)Obtains the latest document for a given id from the tlog or index (if not found in the tlog).static SolrInputDocumentgetInputDocumentFromTlog(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseNonStoredDVs, boolean resolveFullDocument)returns the SolrInputDocument from the current tlog, or DELETED if it has been deleted, or null if there is no record of it in the current update log.voidprepare(ResponseBuilder rb)Prepare the response.voidprocess(ResponseBuilder rb)Process the request for this componentvoidprocessGetFingeprint(ResponseBuilder rb)voidprocessGetUpdates(ResponseBuilder rb)voidprocessGetVersions(ResponseBuilder rb)voidprocessSync(ResponseBuilder rb, int nVersions, String sync)voidprocessSyncWithLeader(ResponseBuilder rb, int nVersions, String syncWithLeader, List<Long> versions)static SolrDocumenttoSolrDoc(SolrInputDocument sdoc, IndexSchema schema)Converts a SolrInputDocument to SolrDocument, using an IndexSchema instance.static SolrDocumenttoSolrDoc(SolrInputDocument sdoc, IndexSchema schema, boolean forInPlaceUpdate)Converts a SolrInputDocument to SolrDocument, using an IndexSchema instance.-
Methods inherited from class org.apache.solr.handler.component.SearchComponent
getMetricNames, getMetricRegistry, getName, handleResponses, init, modifyRequest, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricsSnapshot, registerMetricName
-
-
-
-
Field Detail
-
COMPONENT_NAME
public static final String COMPONENT_NAME
- See Also:
- Constant Field Values
-
DELETED
public static SolrInputDocument DELETED
-
-
Method Detail
-
prepare
public void prepare(ResponseBuilder rb) throws IOException
Description copied from class:SearchComponentPrepare the response. Guaranteed to be called before any SearchComponentSearchComponent.process(org.apache.solr.handler.component.ResponseBuilder)method. Called for every incoming request. The place to do initialization that is request dependent.- Specified by:
preparein classSearchComponent- Parameters:
rb- TheResponseBuilder- Throws:
IOException- If there is a low-level I/O error.
-
process
public void process(ResponseBuilder rb) throws IOException
Description copied from class:SearchComponentProcess the request for this component- Specified by:
processin classSearchComponent- Parameters:
rb- TheResponseBuilder- Throws:
IOException- If there is a low-level I/O error.
-
getInputDocumentFromTlog
public static SolrInputDocument getInputDocumentFromTlog(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseNonStoredDVs, boolean resolveFullDocument)
returns the SolrInputDocument from the current tlog, or DELETED if it has been deleted, or null if there is no record of it in the current update log. If null is returned, it could still be in the latest index.- Parameters:
versionReturned- If a non-null AtomicLong is passed in, it is set to the version of the update returned from the TLog.resolveFullDocument- In case the document is fetched from the tlog, it could only be a partial document if the last update was an in-place update. In that case, should this partial document be resolved to a full document (by following back prevPointer/prevVersion)?
-
getInputDocument
public static SolrInputDocument getInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, RealTimeGetComponent.Resolution lookupStrategy) throws IOException
Obtains the latest document for a given id from the tlog or index (if not found in the tlog). NOTE: This method uses the effective value for nonStoredDVs as null in the call to @seegetInputDocument(SolrCore, BytesRef, AtomicLong, Set, Resolution), so as to retrieve all stored and non-stored DV fields from all documents.- Throws:
IOException
-
getInputDocument
public static SolrInputDocument getInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseNonStoredDVs, RealTimeGetComponent.Resolution resolveStrategy) throws IOException
Obtains the latest document for a given id from the tlog or through the realtime searcher (if not found in the tlog).- Parameters:
versionReturned- If a non-null AtomicLong is passed in, it is set to the version of the update returned from the TLog.onlyTheseNonStoredDVs- If not-null, populate only these DV fields in the document fetched through the realtime searcher. If this is null, decorate all non-stored DVs (that are not targets of copy fields) from the searcher. When non-null, stored fields are not fetched.resolveStrategy- The strategy to resolve the the document.- Throws:
IOException- See Also:
RealTimeGetComponent.Resolution
-
toSolrDoc
public static SolrDocument toSolrDoc(SolrInputDocument sdoc, IndexSchema schema)
Converts a SolrInputDocument to SolrDocument, using an IndexSchema instance.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
toSolrDoc
public static SolrDocument toSolrDoc(SolrInputDocument sdoc, IndexSchema schema, boolean forInPlaceUpdate)
Converts a SolrInputDocument to SolrDocument, using an IndexSchema instance.- Parameters:
sdoc- The input document.schema- The index schema.forInPlaceUpdate- Whether the document is being used for an in place update, seeDocumentBuilder.toDocument(SolrInputDocument, IndexSchema, boolean, boolean)
-
distributedProcess
public int distributedProcess(ResponseBuilder rb) throws IOException
Description copied from class:SearchComponentProcess for a distributed search.- Overrides:
distributedProcessin classSearchComponent- Returns:
- the next stage for this component
- Throws:
IOException
-
createSubRequests
public int createSubRequests(ResponseBuilder rb) throws IOException
- Throws:
IOException
-
finishStage
public void finishStage(ResponseBuilder rb)
private void handleRegularResponses(ResponseBuilder rb, ShardRequest sreq) { }- Overrides:
finishStagein classSearchComponent
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean- Specified by:
getDescriptionin classSearchComponent
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBeanCategory of this component- Specified by:
getCategoryin interfaceSolrInfoBean- Overrides:
getCategoryin classSearchComponent
-
processGetFingeprint
public void processGetFingeprint(ResponseBuilder rb) throws IOException
- Throws:
IOException
-
processGetVersions
public void processGetVersions(ResponseBuilder rb) throws IOException
- Throws:
IOException
-
processSyncWithLeader
public void processSyncWithLeader(ResponseBuilder rb, int nVersions, String syncWithLeader, List<Long> versions)
-
processSync
public void processSync(ResponseBuilder rb, int nVersions, String sync)
-
processGetUpdates
public void processGetUpdates(ResponseBuilder rb) throws IOException
- Throws:
IOException
-
-