lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1384567 - in /lucene/dev/trunk/solr: ./ core/src/java/org/apache/solr/handler/component/ core/src/test-files/solr/collection1/conf/ core/src/test/org/apache/solr/handler/component/
Date Thu, 13 Sep 2012 22:17:25 GMT
Author: hossman
Date: Thu Sep 13 22:17:24 2012
New Revision: 1384567

URL: http://svn.apache.org/viewvc?rev=1384567&view=rev
Log:
SOLR-3828: Fixed QueryElevationComponent so that using 'markExcludes' does not modify the
result set or ranking of 'excluded' documents relative to not using elevation at all

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
    lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/elevate.xml
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1384567&r1=1384566&r2=1384567&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Thu Sep 13 22:17:24 2012
@@ -158,6 +158,11 @@ Bug Fixes
 * SOLR-3809: Fixed config file replication when subdirectories are used
   (Emmanuel Espina via hossman)
 
+* SOLR-3828: Fixed QueryElevationComponent so that using 'markExcludes' does 
+  not modify the result set or ranking of 'excluded' documents relative to 
+  not using elevation at all.  (Alexey Serba via hossman)
+
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java?rev=1384567&r1=1384566&r2=1384567&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
Thu Sep 13 22:17:24 2012
@@ -385,9 +385,6 @@ public class QueryElevationComponent ext
             //we are only going to mark items as excluded, not actually exclude them.  This
works
             //with the EditorialMarkerFactory
             rb.req.getContext().put(EXCLUDED, booster.excludeIds);
-            for (TermQuery tq : booster.exclude) {
-              newq.add(new BooleanClause(tq, BooleanClause.Occur.SHOULD));
-            }
           }
         }
         rb.setQuery(newq);

Modified: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/elevate.xml?rev=1384567&r1=1384566&r2=1384567&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/elevate.xml (original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/elevate.xml Thu Sep 13
22:17:24 2012
@@ -41,6 +41,11 @@
   <doc id="5" />
   <doc id="6" exclude="true" />
  </query>
+ 
+ <query text="QQQQ">
+  <doc id="10" exclude="true" />
+ </query>
+ 
 
  <query text="solr">
   <doc id="7" />

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1384567&r1=1384566&r2=1384567&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
Thu Sep 13 22:17:24 2012
@@ -159,7 +159,7 @@ public class QueryElevationComponentTest
       req.close();
 
       // Make sure the boosts loaded properly
-      assertEquals(6, map.size());
+      assertEquals(7, map.size());
       assertEquals(1, map.get("XXXX").priority.size());
       assertEquals(2, map.get("YYYY").priority.size());
       assertEquals(3, map.get("ZZZZ").priority.size());
@@ -176,7 +176,7 @@ public class QueryElevationComponentTest
       comp.init(args);
       comp.inform(core);
       map = comp.getElevationMap(reader, core);
-      assertEquals(6, map.size());
+      assertEquals(7, map.size());
       assertEquals(null, map.get("XXXX"));
       assertEquals(null, map.get("YYYY"));
       assertEquals(null, map.get("ZZZZ"));
@@ -251,21 +251,28 @@ public class QueryElevationComponentTest
       assertU(adoc("id", "5", "title", "YYYY YYYY", "str_s1", "y"));
       assertU(adoc("id", "6", "title", "XXXX XXXX", "str_s1", "z"));
       assertU(adoc("id", "7", "title", "AAAA", "str_s1", "a"));
+      
+      assertU(adoc("id", "8", "title", "QQQQ", "str_s1", "q"));
+      assertU(adoc("id", "9", "title", "QQQQ QQQQ", "str_s1", "r"));
+      assertU(adoc("id", "10", "title", "QQQQ QQQQ QQQQ", "str_s1", "s"));
+      
       assertU(commit());
 
       assertQ("", req(CommonParams.Q, "XXXX XXXX", CommonParams.QT, "/elevate",
           QueryElevationParams.MARK_EXCLUDES, "true",
+          "indent", "true",
           CommonParams.FL, "id, score, [excluded]")
           , "//*[@numFound='4']"
           , "//result/doc[1]/str[@name='id'][.='5']"
-          , "//result/doc[2]/str[@name='id'][.='6']"
-          , "//result/doc[3]/str[@name='id'][.='1']"
-          , "//result/doc[4]/str[@name='id'][.='4']",
+          , "//result/doc[2]/str[@name='id'][.='1']"
+          , "//result/doc[3]/str[@name='id'][.='4']"
+          , "//result/doc[4]/str[@name='id'][.='6']",
           "//result/doc[1]/bool[@name='[excluded]'][.='false']",
-          "//result/doc[2]/bool[@name='[excluded]'][.='true']",
+          "//result/doc[2]/bool[@name='[excluded]'][.='false']",
           "//result/doc[3]/bool[@name='[excluded]'][.='false']",
-          "//result/doc[4]/bool[@name='[excluded]'][.='false']"
+          "//result/doc[4]/bool[@name='[excluded]'][.='true']"
       );
+      
       //ask for excluded as a field, but don't actually request the MARK_EXCLUDES
       //thus, number 6 should not be returned, b/c it is excluded
       assertQ("", req(CommonParams.Q, "XXXX XXXX", CommonParams.QT, "/elevate",
@@ -279,7 +286,32 @@ public class QueryElevationComponentTest
           "//result/doc[2]/bool[@name='[excluded]'][.='false']",
           "//result/doc[3]/bool[@name='[excluded]'][.='false']"
       );
-
+      
+      // test that excluded results are on the same positions in the result list
+      // as when elevation component is disabled
+      // (i.e. test that elevation component with MARK_EXCLUDES does not boost
+      // excluded results)
+      assertQ("", req(CommonParams.Q, "QQQQ", CommonParams.QT, "/elevate",
+          QueryElevationParams.ENABLE, "false",
+          "indent", "true",
+          CommonParams.FL, "id, score")
+          , "//*[@numFound='3']"
+          , "//result/doc[1]/str[@name='id'][.='8']"
+          , "//result/doc[2]/str[@name='id'][.='9']"
+          , "//result/doc[3]/str[@name='id'][.='10']"
+      );
+      assertQ("", req(CommonParams.Q, "QQQQ", CommonParams.QT, "/elevate",
+          QueryElevationParams.MARK_EXCLUDES, "true",
+          "indent", "true",
+          CommonParams.FL, "id, score, [excluded]")
+          , "//*[@numFound='3']"
+          , "//result/doc[1]/str[@name='id'][.='8']"
+          , "//result/doc[2]/str[@name='id'][.='9']"
+          , "//result/doc[3]/str[@name='id'][.='10']",
+          "//result/doc[1]/bool[@name='[excluded]'][.='false']",
+          "//result/doc[2]/bool[@name='[excluded]'][.='false']",
+          "//result/doc[3]/bool[@name='[excluded]'][.='true']"
+      );
     } finally {
       delete();
     }



Mime
View raw message