lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject [lucene-solr] branch branch_8x updated: SOLR-5211: Document that delete-by-id (and updates) don't affect child/nested docs
Date Fri, 01 Feb 2019 20:25:07 GMT
This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 10930fd  SOLR-5211: Document that delete-by-id (and updates) don't affect child/nested
docs
10930fd is described below

commit 10930fd83a0fb8de9d308737f88cacd50951cc13
Author: David Smiley <dsmiley@apache.org>
AuthorDate: Fri Feb 1 15:21:16 2019 -0500

    SOLR-5211: Document that delete-by-id (and updates) don't affect child/nested docs
    
    (cherry picked from commit 372d68f7f68a5a9238fdfbddeae6488432795603)
---
 solr/CHANGES.txt                                   |  8 ++++-
 .../src/uploading-data-with-index-handlers.adoc    |  7 ++--
 .../org/apache/solr/client/solrj/SolrClient.java   | 38 ++++++++++++----------
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8e9f117..d7dfb40 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -133,7 +133,13 @@ Upgrade Notes
 
 * SOLR-11774: In 'langid' contrib, the LanguageIdentifierUpdateProcessor base class changed
some method signatures. 
   If you have a custom language identifier implementation you will need to adapt your code.
-  
+
+* 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
 ----------------------
 
diff --git a/solr/solr-ref-guide/src/uploading-data-with-index-handlers.adoc b/solr/solr-ref-guide/src/uploading-data-with-index-handlers.adoc
index 7b1ae65..96ad256 100644
--- a/solr/solr-ref-guide/src/uploading-data-with-index-handlers.adoc
+++ b/solr/solr-ref-guide/src/uploading-data-with-index-handlers.adoc
@@ -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":
 
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java
index f435150..8aebea0 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java
@@ -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


Mime
View raw message