mirror of https://github.com/apache/lucene.git
SOLR-4854: Add a test to assert that [elevated] DocTransfer works correctly with javabin response format
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1710667 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
737a62843e
commit
9e779427aa
|
@ -386,6 +386,9 @@ Other Changes
|
|||
* SOLR-8195: IndexFetcher download trace now includes bytes-downloaded[-per-second]
|
||||
(Christine Poerschke)
|
||||
|
||||
* SOLR-4854: Add a test to assert that [elevated] DocTransfer works correctly with javabin
|
||||
response format. (Ray, shalin)
|
||||
|
||||
================== 5.3.1 ==================
|
||||
|
||||
Bug Fixes
|
||||
|
|
|
@ -19,9 +19,8 @@ package org.apache.solr.response.transform;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.handler.component.QueryElevationComponent;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.schema.FieldType;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
|
@ -48,7 +47,7 @@ class MarkTransformer extends BaseEditorialTransformer {
|
|||
|
||||
@Override
|
||||
protected Set<String> getIdSet() {
|
||||
return (Set<String>) context.getRequest().getContext().get("BOOSTED");
|
||||
return (Set<String>) context.getRequest().getContext().get(QueryElevationComponent.BOOSTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ import java.io.File;
|
|||
import org.apache.lucene.util.Constants;
|
||||
|
||||
import org.apache.solr.BaseDistributedSearchTestCase;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.impl.BinaryResponseParser;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -92,6 +97,31 @@ public class DistributedQueryElevationComponentTest extends BaseDistributedSearc
|
|||
query("q", "solr", "qt", "/elevate", "shards.qt", "/elevate", "rows", "500", CommonParams.FL, "*, [elevated]", "forceElevation", "true", "sort", "int_i asc");
|
||||
|
||||
query("q", "ZZZZ", "qt", "/elevate", "shards.qt", "/elevate", "rows", "500", CommonParams.FL, "*, [elevated]", "forceElevation", "true", "sort", "id desc");
|
||||
|
||||
// See SOLR-4854 for background on following test code
|
||||
|
||||
// Uses XML response format by default
|
||||
QueryResponse response = query("q", "XXXX", "qt", "/elevate", "shards.qt", "/elevate", "rows", "500", CommonParams.FL, "id, [elevated]", "enableElevation", "true",
|
||||
"forceElevation", "true", "elevateIds", "6", "sort", "id desc");
|
||||
|
||||
assertTrue(response.getResults().getNumFound() > 0);
|
||||
SolrDocument document = response.getResults().get(0);
|
||||
assertEquals(6.0f, document.getFieldValue("id"));
|
||||
assertEquals(true, document.getFieldValue("[elevated]"));
|
||||
|
||||
// Force javabin format
|
||||
HttpSolrClient client = new HttpSolrClient(((HttpSolrClient)clients.get(0)).getBaseURL());
|
||||
client.setParser(new BinaryResponseParser());
|
||||
SolrQuery solrQuery = new SolrQuery("XXXX").setParam("qt", "/elevate").setParam("shards.qt", "/elevate").setRows(500).setFields("id,[elevated]")
|
||||
.setParam("enableElevation", "true").setParam("forceElevation", "true").setParam("elevateIds", "6", "wt", "javabin")
|
||||
.setSort("id", SolrQuery.ORDER.desc);
|
||||
setDistributedParams(solrQuery);
|
||||
response = client.query(solrQuery);
|
||||
|
||||
assertTrue(response.getResults().getNumFound() > 0);
|
||||
document = response.getResults().get(0);
|
||||
assertEquals(6.0f, document.getFieldValue("id"));
|
||||
assertEquals(true, document.getFieldValue("[elevated]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue