Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/416#discussion_r211595043
  
    --- Diff: 
solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformerHierarchy.java
 ---
    @@ -0,0 +1,346 @@
    +/*
    + * 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.response.transform;
    +
    +import java.util.Collection;
    +import java.util.Iterator;
    +import java.util.Map;
    +import java.util.concurrent.atomic.AtomicInteger;
    +import java.util.stream.Collectors;
    +
    +import com.google.common.collect.Iterables;
    +import org.apache.lucene.index.IndexableField;
    +import org.apache.solr.SolrTestCaseJ4;
    +import org.apache.solr.common.SolrDocument;
    +import org.apache.solr.request.SolrQueryRequest;
    +import org.apache.solr.response.BasicResultContext;
    +import org.junit.After;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +
    +public class TestChildDocTransformerHierarchy extends SolrTestCaseJ4 {
    +
    +  private static AtomicInteger counter = new AtomicInteger();
    +  private static final String[] types = {"donut", "cake"};
    +  private static final String[] ingredients = {"flour", "cocoa", 
"vanilla"};
    +  private static final Iterator<String> ingredientsCycler = 
Iterables.cycle(ingredients).iterator();
    +  private static final String[] names = {"Yaz", "Jazz", "Costa"};
    +  private static final String[] fieldsToRemove = {"_nest_parent_", 
"_nest_path_", "_root_"};
    +  private static final int sumOfDocsPerNestedDocument = 8;
    +  private static final int numberOfDocsPerNestedTest = 10;
    +  private static int randomDocTopId = 0;
    +  private static String fqToExcludeNoneTestedDocs; // filter documents 
that were created for random segments to ensure the transformer works with 
multiple segments.
    +
    +  @BeforeClass
    +  public static void beforeClass() throws Exception {
    +    initCore("solrconfig-update-processor-chains.xml", "schema-nest.xml"); 
// use "nest" schema
    +    final boolean useSegments = random().nextBoolean();
    +    if(useSegments) {
    +      // create random segments
    +      final int numOfDocs = 10;
    +      for(int i = 0; i < numOfDocs; ++i) {
    +        updateJ(generateDocHierarchy(i), params("update.chain", "nested"));
    +        if(random().nextBoolean()) {
    +          assertU(commit());
    +        }
    +      }
    +      assertU(commit());
    +      randomDocTopId = counter.get();
    --- End diff --
    
    I think this line should be at the end of this method, executed always.  I 
can see it works where it is now, executed conditionally, but I think it'd be 
clearer if not done in a condition.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to