Class DocBasedVersionConstraintsProcessor

    • 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.
        newUserVersions - New versions in update request
        oldUserVersions - Old versions currently in solr index
        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.
        newUserVersion - User-specified version on the new version of the document
        oldUserVersion - User-specified version on the old version of the document
        userVersionFieldName - Field name of the user versions being compared
        True if acceptable, false if not.
      • 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
        Note that if the schema contains required fields (other than version fields or uniqueKey), they should be populated by the tombstoneConfig, otherwise this tombstone will fail when indexing (and consequently the delete will fail). Alternatively, required fields must be populated by some other means (like DocBasedVersionConstraintsProcessorFactory or similar)