SOLR-7912: Removing complicated query assertions from the MLTQParser cloud test as it was getting to be more of a hack. Only test for doc ordering and query assertion in simple cases.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1716156 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-11-24 15:19:18 +00:00
parent 1af0271c67
commit 2162d892f2
1 changed files with 4 additions and 28 deletions

View File

@ -17,6 +17,10 @@ package org.apache.solr.search.mlt;
* limitations under the License.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
@ -29,11 +33,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
public class CloudMLTQParserTest extends AbstractFullDistribZkTestBase {
static Logger log = LoggerFactory.getLogger(CloudMLTQParserTest.class);
@ -160,21 +159,6 @@ public class CloudMLTQParserTest extends AbstractFullDistribZkTestBase {
assertArrayEquals(expectedIds, actualIds);
expectedQueryStrings = new String[]{
"(+(lowerfilt:bmw lowerfilt:usa) -id:26)/no_coord",
"(+(lowerfilt:usa lowerfilt:bmw lowerfilt:328i) -id:26)/no_coord"};
if(queryResponse.getDebugMap().get("parsedquery") instanceof String) {
// todo: We might run into issues here. Should think about a better way to test this.
// Skipping testing in this case for now.
// actualParsedQueries = new String[]{(String) queryResponse.getDebugMap().get("parsedquery")};
} else {
actualParsedQueries = ((ArrayList<String>) queryResponse
.getDebugMap().get("parsedquery")).toArray(new String[0]);
Arrays.sort(actualParsedQueries);
assertArrayEquals(expectedQueryStrings, actualParsedQueries);
}
params = new ModifiableSolrParams();
// Test out a high value of df and make sure nothing matches.
params.set(CommonParams.Q, "{!mlt qf=lowerfilt mindf=20 mintf=1}3");
@ -228,12 +212,4 @@ public class CloudMLTQParserTest extends AbstractFullDistribZkTestBase {
// Do nothing.
}
}
private boolean compareParsedQueryStrings(String expected, String actual) {
HashSet<String> expectedQueryParts = new HashSet<>();
expectedQueryParts.addAll(Arrays.asList(expected.split("\\s+")));
HashSet<String> actualQueryParts = new HashSet();
actualQueryParts.addAll(Arrays.asList(actual.split("\\s+")));
return expectedQueryParts.containsAll(actualQueryParts);
}
}