LUCENE-6609: refactor Solr tests to isolate SortedSetSelector dependent code into a test that SuppressCodecs the problematic docvalues formats

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1694090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2015-08-04 17:19:55 +00:00
parent c1522a9c75
commit 4ceb26a3ce
2 changed files with 54 additions and 3 deletions

View File

@ -22,7 +22,7 @@ import org.junit.BeforeClass;
/**
*
*
* @see TestSortByMinMaxFunction
**/
public class SortByFunctionTest extends AbstractSolrTestCase {
@ -129,11 +129,23 @@ public class SortByFunctionTest extends AbstractSolrTestCase {
"//result/doc[4]/int[@name='id'][.='1']"
);
}
/**
* The sort clauses to test in <code>testFieldSortSpecifiedAsFunction</code>.
*
* @see #testFieldSortSpecifiedAsFunction
*/
protected String[] getFieldFunctionClausesToTest() {
return new String[] { "primary_tl1", "field(primary_tl1)" };
}
/**
* Sort by function normally compares the double value, but if a function is specified that identifies
* a single field, we should use the underlying field's SortField to save of a lot of type converstion
* (and RAM), and keep the sort precision as high as possible
*
* @see #getFieldFunctionClausesToTest
*/
public void testFieldSortSpecifiedAsFunction() throws Exception {
final long A = Long.MIN_VALUE;
@ -170,8 +182,9 @@ public class SortByFunctionTest extends AbstractSolrTestCase {
assertU(commit());
// all of these sorts should result in the exact same order
for (String primarySort : new String[] { "primary_tl1", "field(primary_tl1)",
"field(multi_l_dv,max)", "field(multi_l_dv,min)" }) {
// min/max of a field is tested in TestSortByMinMaxFunction
for (String primarySort : getFieldFunctionClausesToTest()) {
assertQ(req("q", "*:*",
"sort", primarySort + " asc, secondary_tl1 asc")
, "//*[@numFound='9']"

View File

@ -0,0 +1,38 @@
package org.apache.solr.search.function;
/*
* 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.
*/
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.BeforeClass;
/**
* Split out from SortByFunctionTest due to codec support limitations for SortedSetSelector
*
* @see SortByFunctionTest
**/
@SuppressCodecs({"Memory", "SimpleText"}) // see TestSortedSetSelector
public class TestSortByMinMaxFunction extends SortByFunctionTest {
@Override
public String[] getFieldFunctionClausesToTest() {
return new String[] { "primary_tl1", "field(primary_tl1)",
"field(multi_l_dv,max)", "field(multi_l_dv,min)" };
}
}