diff --git a/src/java/org/apache/solr/util/SolrDocument.java b/src/java/org/apache/solr/util/SolrDocument.java index 885467d68e9..cfae9a61257 100644 --- a/src/java/org/apache/solr/util/SolrDocument.java +++ b/src/java/org/apache/solr/util/SolrDocument.java @@ -65,6 +65,15 @@ public class SolrDocument // Add / Set / Remove Fields /////////////////////////////////////////////////////////////////// + /** + * Remove all fields from the document + */ + public void clear() + { + _fields.clear(); + } + + /** * Remove all fields with the name */ diff --git a/src/java/org/apache/solr/util/SolrInputDocument.java b/src/java/org/apache/solr/util/SolrInputDocument.java index 22437c04ceb..a1ae28fa79e 100644 --- a/src/java/org/apache/solr/util/SolrInputDocument.java +++ b/src/java/org/apache/solr/util/SolrInputDocument.java @@ -32,6 +32,18 @@ import java.util.Map; public class SolrInputDocument extends SolrDocument { private Map _boost = null; + + /** + * Remove all fields and boosts from the document + */ + @Override + public void clear() + { + super.clear(); + if( _boost != null ) { + _boost.clear(); + } + } /** * Set the document boost. null will remove the boost