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
-
Field Summary
Fields inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
next -
Constructor Summary
ConstructorsConstructorDescriptionDocBasedVersionConstraintsProcessor(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
Modifier and TypeMethodDescriptionprotected org.apache.solr.common.SolrInputDocumentcreateTombstoneDocument(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.voidvoidprotected booleanversionInUpdateIsAcceptable(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 Details
-
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 Details
-
versionInUpdateIsAcceptable
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
- Overrides:
processAddin classUpdateRequestProcessor- Throws:
IOException
-
processDelete
- Overrides:
processDeletein 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
versionFieldparameter) - All the fields set in the
tombstoneConfigparameter
tombstoneConfig, otherwise this tombstone will fail when indexing (and consequently the delete will fail). Alternatively, required fields must be populated by some other means (likeDocBasedVersionConstraintsProcessorFactoryor similar)
-