SOLR-5211: Document that delete-by-id (and updates) don't affect child/nested docs

This commit is contained in:
David Smiley 2019-02-01 15:21:16 -05:00
parent 4a3ddc94d8
commit 372d68f7f6
3 changed files with 32 additions and 19 deletions

View File

@ -144,6 +144,12 @@ Upgrade Notes
* SOLR-9515: Hadoop dependencies have been upgraded to Hadoop 3.2.0 from 2.7.2. (Mark Miller, Kevin Risden)
* SOLR-5211: Deleting (or updating) documents by their uniqueKey is now scoped to only consider root documents, not
child/nested documents. Thus a delete-by-id won't work on a child doc (no-op), and an attempt to update a child doc
by providing a new doc with the same ID would add a new doc (probably erroneous). Both these actions were and still
are problematic. In-place-updates are safe though. If you want to delete certain child documents and if you know
they don't themselves have nested children then you must do so with a delete-by-query technique.
New Features
----------------------

View File

@ -113,7 +113,10 @@ Here are examples of `<commit>` and `<optimize>` using optional attributes:
==== Delete Operations
Documents can be deleted from the index in two ways. "Delete by ID" deletes the document with the specified ID, and can be used only if a UniqueID field has been defined in the schema. "Delete by Query" deletes all documents matching a specified query, although `commitWithin` is ignored for a Delete by Query. A single delete message can contain multiple delete operations.
Documents can be deleted from the index in two ways.
"Delete by ID" deletes the document with the specified ID, and can be used only if a UniqueID field has been defined in the schema.
It doesn't work for child/nested docs.
"Delete by Query" deletes all documents matching a specified query, although `commitWithin` is ignored for a Delete by Query. A single delete message can contain multiple delete operations.
[source,xml]
----
@ -378,7 +381,7 @@ Or a list of document IDs:
{ "delete":["id1","id2"] }
----
The value of a "delete" can be an array which contains a list of zero or more id's to be deleted. It is not a range (start and end).
Note: Delete-by-id doesn't work for child/nested docs.
You can also specify `\_version_` with each "delete":

View File

@ -16,6 +16,15 @@
*/
package org.apache.solr.client.solrj;
import java.io.Closeable;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.beans.DocumentObjectBinder;
import org.apache.solr.client.solrj.impl.StreamingBinaryResponseParser;
@ -34,15 +43,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import java.io.Closeable;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* Abstraction through which all communication with a Solr server may be routed
*
@ -739,7 +739,7 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a single document by unique ID
* Deletes a single document by unique ID. Doesn't work for child/nested docs.
*
* @param collection the Solr collection to delete the document from
* @param id the ID of the document to delete
@ -755,7 +755,7 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a single document by unique ID
* Deletes a single document by unique ID. Doesn't work for child/nested docs.
*
* @param id the ID of the document to delete
*
@ -770,7 +770,8 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a single document by unique ID, specifying max time before commit
* Deletes a single document by unique ID, specifying max time before commit.
* Doesn't work for child/nested docs.
*
* @param collection the Solr collection to delete the document from
* @param id the ID of the document to delete
@ -792,7 +793,8 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a single document by unique ID, specifying max time before commit
* Deletes a single document by unique ID, specifying max time before commit.
* Doesn't work for child/nested docs.
*
* @param id the ID of the document to delete
* @param commitWithinMs max time (in ms) before a commit will happen
@ -810,7 +812,7 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a list of documents by unique ID
* Deletes a list of documents by unique ID. Doesn't work for child/nested docs.
*
* @param collection the Solr collection to delete the documents from
* @param ids the list of document IDs to delete; must be non-null and contain elements
@ -826,7 +828,7 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a list of documents by unique ID
* Deletes a list of documents by unique ID. Doesn't work for child/nested docs.
*
* @param ids the list of document IDs to delete; must be non-null and contain elements
*
@ -841,7 +843,8 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a list of documents by unique ID, specifying max time before commit
* Deletes a list of documents by unique ID, specifying max time before commit.
* Doesn't work for child/nested docs.
*
* @param collection the Solr collection to delete the documents from
* @param ids the list of document IDs to delete; must be non-null and contain elements
@ -866,7 +869,8 @@ public abstract class SolrClient implements Serializable, Closeable {
}
/**
* Deletes a list of documents by unique ID, specifying max time before commit
* Deletes a list of documents by unique ID, specifying max time before commit.
* Doesn't work for child/nested docs.
*
* @param ids the list of document IDs to delete
* @param commitWithinMs max time (in ms) before a commit will happen