Package org.apache.solr.update.processor
Class DocBasedVersionConstraintsProcessor
- java.lang.Object
-
- org.apache.solr.update.processor.UpdateRequestProcessor
-
- org.apache.solr.update.processor.DocBasedVersionConstraintsProcessor
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class DocBasedVersionConstraintsProcessor extends UpdateRequestProcessor
-
-
Field Summary
-
Fields inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
next
-
-
Constructor Summary
Constructors Constructor Description DocBasedVersionConstraintsProcessor(List<String> versionFields, boolean ignoreOldUpdates, List<String> deleteVersionParamNames, boolean supportMissingVersionOnOldDocs, boolean useFieldCache, org.apache.solr.common.util.NamedList<Object> tombstoneConfig, SolrQueryRequest req, UpdateRequestProcessor next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.solr.common.SolrInputDocument
createTombstoneDocument(IndexSchema schema, String id, String[] versionFieldNames, String[] deleteParamValues, org.apache.solr.common.util.NamedList<Object> tombstoneConfig)
Creates a tombstone document, that will be used to update a document that's being deleted by ID.protected <T extends Comparable<? super T>>
booleannewUpdateComparePasses(T newUserVersion, T oldUserVersion, String userVersionFieldName)
Given two comparable user versions, returns whether the new version is acceptable to replace the old version.void
processAdd(AddUpdateCommand cmd)
void
processDelete(DeleteUpdateCommand cmd)
protected boolean
versionInUpdateIsAcceptable(Object[] newUserVersions, Object[] oldUserVersions)
Returns whether or not the versions in the command are acceptable to be indexed.-
Methods inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
close, doClose, finish, processCommit, processMergeIndexes, processRollback
-
-
-
-
Constructor Detail
-
DocBasedVersionConstraintsProcessor
public DocBasedVersionConstraintsProcessor(List<String> versionFields, boolean ignoreOldUpdates, List<String> deleteVersionParamNames, boolean supportMissingVersionOnOldDocs, boolean useFieldCache, org.apache.solr.common.util.NamedList<Object> tombstoneConfig, SolrQueryRequest req, UpdateRequestProcessor next)
-
-
Method Detail
-
versionInUpdateIsAcceptable
protected boolean versionInUpdateIsAcceptable(Object[] newUserVersions, Object[] oldUserVersions)
Returns whether or not the versions in the command are acceptable to be indexed. If the instance is set to ignoreOldUpdates==false, it will throw a SolrException with CONFLICT in the event the version is not acceptable rather than return false.- Parameters:
newUserVersions
- New versions in update requestoldUserVersions
- Old versions currently in solr index- Returns:
- True if acceptable, false if not (or will throw exception)
-
newUpdateComparePasses
protected <T extends Comparable<? super T>> boolean newUpdateComparePasses(T newUserVersion, T oldUserVersion, String userVersionFieldName)
Given two comparable user versions, returns whether the new version is acceptable to replace the old version.- Parameters:
newUserVersion
- User-specified version on the new version of the documentoldUserVersion
- User-specified version on the old version of the documentuserVersionFieldName
- Field name of the user versions being compared- Returns:
- True if acceptable, false if not.
-
processAdd
public void processAdd(AddUpdateCommand cmd) throws IOException
- Overrides:
processAdd
in classUpdateRequestProcessor
- Throws:
IOException
-
processDelete
public void processDelete(DeleteUpdateCommand cmd) throws IOException
- Overrides:
processDelete
in classUpdateRequestProcessor
- Throws:
IOException
-
createTombstoneDocument
protected org.apache.solr.common.SolrInputDocument createTombstoneDocument(IndexSchema schema, String id, String[] versionFieldNames, String[] deleteParamValues, org.apache.solr.common.util.NamedList<Object> tombstoneConfig)
Creates a tombstone document, that will be used to update a document that's being deleted by ID. The returned document will contain:- uniqueKey
- versions (All the fields configured as in the
versionField
parameter) - All the fields set in the
tombstoneConfig
parameter
tombstoneConfig
, otherwise this tombstone will fail when indexing (and consequently the delete will fail). Alternatively, required fields must be populated by some other means (likeDocBasedVersionConstraintsProcessorFactory
or similar)
-
-