You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/01 21:51:42 UTC

[GitHub] [lucene-solr] anshumg commented on a change in pull request #1456: SOLR-13289: Support for BlockMax WAND

anshumg commented on a change in pull request #1456:
URL: https://github.com/apache/lucene-solr/pull/1456#discussion_r418678327



##########
File path: solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
##########
@@ -401,6 +403,14 @@ public void process(ResponseBuilder rb) throws IOException
     doProcessUngroupedSearch(rb, cmd, result);
   }
 
+  private int getMinExactHits(SolrParams params) {
+    long minExactHits = params.getLong(CommonParams.MIN_EXACT_HITS, Integer.MAX_VALUE);
+    if (minExactHits < 0 || minExactHits > Integer.MAX_VALUE) {

Review comment:
       This doesn't really allow anyone to specify a minExactHits value between Integer.MAX_VALUE and Long.MAX_VALUE. For practical reasons, that is ok but just not consistent and would require a note in the ref guide too. Do you think we should just switch this out with Long instead?

##########
File path: solr/core/src/java/org/apache/solr/response/JSONWriter.java
##########
@@ -132,11 +133,16 @@ public void writeSolrDocument(String name, SolrDocument doc, ReturnFields return
   //       that the size could not be reliably determined.
   //
 
+  /**
+   * This method will be removed in Solr 9

Review comment:
       This method will be removed `after` Solr 9, right?

##########
File path: solr/core/src/test/org/apache/solr/request/TestFaceting.java
##########
@@ -931,5 +934,28 @@ public void testListedTermCounts() throws Exception {
         "//lst[@name='facet_fields']/lst[@name='title_ws']/int[2][@name='Book2']",
         "//lst[@name='facet_fields']/lst[@name='title_ws']/int[3][@name='Book3']");
   }
+  
+  @Test
+  public void testFacetCountsWithMinExactHits() throws Exception {
+    final int NUM_DOCS = 20;
+    for (int i = 0; i < NUM_DOCS ; i++) {
+      assertU(adoc("id", String.valueOf(i), "title_ws", "Book1"));
+      assertU(commit());

Review comment:
       We can move this commit out of the loop and just commit once.

##########
File path: solr/core/src/test/org/apache/solr/TestDistributedSearch.java
##########
@@ -1082,11 +1086,32 @@ public void test() throws Exception {
     assertEquals(new EnumFieldValue(11, "Critical"),
                  rsp.getFieldStatsInfo().get(fieldName).getMax());
 
-    handle.put("severity", UNORDERED); // this is stupid, but stats.facet doesn't garuntee order
+    handle.put("severity", UNORDERED); // this is stupid, but stats.facet doesn't guarantee order
     query("q", "*:*", "stats", "true", "stats.field", fieldName, 
           "stats.facet", fieldName);
   }
 
+  private void testMinExactHits() throws Exception {
+    assertIsExactHitCount("q","{!cache=false}dog OR men OR cow OR country OR dumpty", CommonParams.MIN_EXACT_HITS, "200", CommonParams.ROWS, "2", CommonParams.SORT, "score desc, id asc");

Review comment:
       :)

##########
File path: solr/core/src/test/org/apache/solr/request/TestFaceting.java
##########
@@ -931,5 +934,28 @@ public void testListedTermCounts() throws Exception {
         "//lst[@name='facet_fields']/lst[@name='title_ws']/int[2][@name='Book2']",
         "//lst[@name='facet_fields']/lst[@name='title_ws']/int[3][@name='Book3']");
   }
+  
+  @Test
+  public void testFacetCountsWithMinExactHits() throws Exception {
+    final int NUM_DOCS = 20;
+    for (int i = 0; i < NUM_DOCS ; i++) {
+      assertU(adoc("id", String.valueOf(i), "title_ws", "Book1"));
+      assertU(commit());
+    }
+    ModifiableSolrParams params = new ModifiableSolrParams();
+    params.set("q", "title_ws:Book1");
+    params.set(FacetParams.FACET, "true");
+    params.set(FacetParams.FACET_FIELD, "title_ws");
+    assertQ(req(params),
+        "//lst[@name='facet_fields']/lst[@name='title_ws']/int[1][@name='Book1'][.='20']"
+        ,"//*[@hitCountRelation='" + HitCountRelation.EQ + "']"
+        ,"//*[@numFound='" + NUM_DOCS + "']");
+    
+    // It doesn't matter if we request munExactHits, when requesting facets, the numFound value is precise

Review comment:
       munExactHits -> numExactHits

##########
File path: solr/core/src/test/org/apache/solr/search/SolrIndexSearcherTest.java
##########
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.search;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermQuery;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.HitCountRelation;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.IOException;
+
+public class SolrIndexSearcherTest extends SolrTestCaseJ4 {
+  
+  private final static int NUM_DOCS = 20;
+
+  @BeforeClass
+  public static void setUpClass() throws Exception {
+    initCore("solrconfig.xml", "schema.xml");
+    for (int i = 0 ; i < NUM_DOCS ; i ++) {
+      assertU(adoc("id", String.valueOf(i), "field1_s", "foo", "field2_s", String.valueOf(i % 2), "field3_s", String.valueOf(i)));
+      assertU(commit());

Review comment:
       We can move the commit out of the loop 

##########
File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
##########
@@ -242,6 +243,7 @@ public void testBackCompatForSolrDocumentWithChildDocs() throws IOException {
   }
 
   @Test
+  @Ignore("This test compares binaries, which change due to SOLR-13289")

Review comment:
       s/change/changed 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org