You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2015/05/23 02:25:14 UTC

svn commit: r1681253 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/update/DocumentBuilder.java solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java

Author: hossman
Date: Sat May 23 00:25:13 2015
New Revision: 1681253

URL: http://svn.apache.org/r1681253
Log:
SOLR-7335: Fix doc boosts to no longer be multiplied in each field value in multivalued fields that are not used in copyFields (merge r1681249)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1681253&r1=1681252&r2=1681253&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Sat May 23 00:25:13 2015
@@ -22,6 +22,11 @@ Versions of Major Components
 Upgrading from Solr 5.1
 -----------------------
 
+* A bug was introduced in Solr 4.10 that caused index time document boosts to trigger excessive field
+  boosts in multivalued fields -- the result being that some field norms might be excessively large.
+  This bug has now been fixed, but users of document boosts are strongly encouraged to re-index.
+  See SOLR-7335 for more details.
+
 * The Slice and Replica classes have been changed to use State enums instead of string constants 
   to track the respective stats.  Advanced users with client code manipulating these objects will 
   need to update their code accordingly.  See SOLR-7325 and SOLR-7336 for more info.
@@ -258,6 +263,8 @@ Bug Fixes
   using the thread-pool managed by ZkContainer instead of a single thread.
   (Jessica Cheng Mallet, Timothy Potter, shalin, Mark Miller)
 
+* SOLR-7335: Fix doc boosts to no longer be multiplied in each field value in multivalued fields that
+  are not used in copyFields (Shingo Sasaki via hossman)
 
 Optimizations
 ----------------------

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java?rev=1681253&r1=1681252&r2=1681253&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/DocumentBuilder.java Sat May 23 00:25:13 2015
@@ -160,13 +160,13 @@ public class DocumentBuilder {
               // record the field as having a value
               usedFields.add(destinationField.getName());
             }
-            
-            // The final boost for a given field named is the product of the 
-            // *all* boosts on values of that field. 
-            // For multi-valued fields, we only want to set the boost on the
-            // first field.
-            fieldBoost = compoundBoost = 1.0f;
           }
+
+          // The final boost for a given field named is the product of the 
+          // *all* boosts on values of that field. 
+          // For multi-valued fields, we only want to set the boost on the
+          // first field.
+          fieldBoost = compoundBoost = 1.0f;
         }
       }
       catch( SolrException ex ) {

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java?rev=1681253&r1=1681252&r2=1681253&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java Sat May 23 00:25:13 2015
@@ -17,6 +17,8 @@
 
 package org.apache.solr.update;
 
+import java.util.List;
+
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.index.LeafReader;
@@ -33,6 +35,7 @@ import org.apache.solr.common.SolrInputF
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.search.DocList;
+import org.apache.solr.schema.CopyField;
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.request.SolrQueryRequest;
@@ -221,12 +224,11 @@ public class DocumentBuilderTest extends
     assertNull(h.validateUpdate(add(xml, new String[0])));
   }
   
-  public void testMultiValuedFieldAndDocBoosts() throws Exception {
+  private void assertMultiValuedFieldAndDocBoosts(SolrInputField field) throws Exception {
     SolrCore core = h.getCore();
     IndexSchema schema = core.getLatestSchema();
     SolrInputDocument doc = new SolrInputDocument();
     doc.setDocumentBoost(3.0f);
-    SolrInputField field = new SolrInputField( "foo_t" );
     field.addValue( "summer time" , 1.0f );
     field.addValue( "in the city" , 5.0f ); // using boost
     field.addValue( "living is easy" , 1.0f );
@@ -247,6 +249,27 @@ public class DocumentBuilderTest extends
     
   }
 
+  public void testMultiValuedFieldAndDocBoostsWithCopy() throws Exception {
+    SolrCore core = h.getCore();
+    IndexSchema schema = core.getLatestSchema();
+    SolrInputField field = new SolrInputField( "foo_t" );
+    List<CopyField> copyFields = schema.getCopyFieldsList(field.getName());
+    
+    assertNotNull( copyFields );
+    assertFalse( copyFields.isEmpty() );
+    assertMultiValuedFieldAndDocBoosts( field );
+  }
+  
+  public void testMultiValuedFieldAndDocBoostsNoCopy() throws Exception {
+    SolrCore core = h.getCore();
+    IndexSchema schema = core.getLatestSchema();
+    SolrInputField field = new SolrInputField( "t_foo" );
+    List<CopyField> copyFields = schema.getCopyFieldsList(field.getName());
+
+    assertTrue( copyFields == null || copyFields.isEmpty() );
+    assertMultiValuedFieldAndDocBoosts( field );
+  }
+
   public void testCopyFieldsAndFieldBoostsAndDocBoosts() throws Exception {
     SolrCore core = h.getCore();
     IndexSchema schema = core.getLatestSchema();