Class RealTimeGetComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- org.apache.solr.handler.component.RealTimeGetComponent
-
- All Implemented Interfaces:
AutoCloseable,SolrInfoBean,SolrMetricProducer,NamedListInitializedPlugin
public class RealTimeGetComponent extends SearchComponent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRealTimeGetComponent.ResolutionLookup strategy for some methods on this class.-
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 org.apache.solr.common.SolrInputDocumentDELETED-
Fields inherited from class org.apache.solr.handler.component.SearchComponent
solrMetricsContext, 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)Called after all responses have been received for this stage.SolrInfoBean.CategorygetCategory()Category of this componentStringgetDescription()Simple one or two line descriptionstatic org.apache.solr.common.SolrInputDocumentgetInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, org.apache.lucene.util.BytesRef rootIdBytes, AtomicLong versionReturned, Set<String> onlyTheseFields, 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 org.apache.solr.common.SolrInputDocumentgetInputDocumentFromTlog(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseFields, RealTimeGetComponent.Resolution resolution)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 org.apache.solr.common.SolrDocumenttoSolrDoc(org.apache.solr.common.SolrInputDocument sdoc, IndexSchema schema)Converts a SolrInputDocument to SolrDocument, using an IndexSchema instance.static org.apache.solr.common.SolrDocumenttoSolrDoc(org.apache.solr.common.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
getName, getSolrMetricsContext, handleResponses, initializeMetrics, 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.util.plugin.NamedListInitializedPlugin
init
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
-
-
-
Field Detail
-
COMPONENT_NAME
public static final String COMPONENT_NAME
- See Also:
- Constant Field Values
-
DELETED
public static org.apache.solr.common.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 org.apache.solr.common.SolrInputDocument getInputDocumentFromTlog(SolrCore core, org.apache.lucene.util.BytesRef idBytes, AtomicLong versionReturned, Set<String> onlyTheseFields, RealTimeGetComponent.Resolution resolution)
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. Copy-field target fields are excluded.- Parameters:
idBytes- doc ID to find; never a child doc.versionReturned- If a non-null AtomicLong is passed in, it is set to the version of the update returned from the TLog.
-
getInputDocument
public static org.apache.solr.common.SolrInputDocument getInputDocument(SolrCore core, org.apache.lucene.util.BytesRef idBytes, org.apache.lucene.util.BytesRef rootIdBytes, AtomicLong versionReturned, Set<String> onlyTheseFields, 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). Fields that are targets of copy-fields are excluded.- Parameters:
idBytes- ID of the document to be fetched.rootIdBytes- the root ID of the document being looked up. If there are no child docs, this is always the same as idBytes.versionReturned- If a non-null AtomicLong is passed in, it is set to the version of the update returned from the TLog.onlyTheseFields- If not-null, this limits the fields that are returned. However it is only an optimization hint since other fields may be returned. Copy field targets are never returned.resolveStrategy-RealTimeGetComponent.Resolution.DOCorRealTimeGetComponent.Resolution.ROOT_WITH_CHILDREN.- Throws:
IOException- See Also:
RealTimeGetComponent.Resolution
-
toSolrDoc
public static org.apache.solr.common.SolrDocument toSolrDoc(org.apache.solr.common.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 org.apache.solr.common.SolrDocument toSolrDoc(org.apache.solr.common.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)
Description copied from class:SearchComponentCalled after all responses have been received for this stage. Useful when different requests are sent to each shard.- 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
-
-