mirror of https://github.com/apache/lucene.git
SOLR-7622: reverting the previos change
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1687689 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3d4c18d748
commit
b00f5b8eaa
|
@ -63,15 +63,15 @@ public abstract class DocTransformer {
|
|||
public abstract void transform(SolrDocument doc, int docid) throws IOException;
|
||||
|
||||
/**
|
||||
* When a transformer needs access to fields that are not automatically derived from the
|
||||
* When a transformer needs access to fields that are not automaticaly derived from the
|
||||
* input fields names, this option lets us explicitly say the field names that we hope
|
||||
* will be in the SolrDocument. These fields will be requested from the
|
||||
* will be in the SolrDocument. These fields will be requestd from the
|
||||
* {@link SolrIndexSearcher} but may or may not be returned in the final
|
||||
* {@link QueryResponseWriter}
|
||||
*
|
||||
* @return a set of extra lucene fields
|
||||
* @return a list of extra lucene fields
|
||||
*/
|
||||
public Set<String> getExtraRequestFields() {
|
||||
public String[] getExtraRequestFields() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ public class SolrReturnFields extends ReturnFields {
|
|||
DocTransformer t = factory.create(disp, augmenterParams, req);
|
||||
if(t!=null) {
|
||||
if(!_wantsAllFields) {
|
||||
Set<String> extra = t.getExtraRequestFields();
|
||||
String[] extra = t.getExtraRequestFields();
|
||||
if(extra!=null) {
|
||||
for(String f : extra) {
|
||||
fields.add(f); // also request this field from IndexSearcher
|
||||
|
|
|
@ -18,11 +18,7 @@ package org.apache.solr.response;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.lucene.document.StoredField;
|
||||
import org.apache.lucene.index.IndexableField;
|
||||
import org.apache.lucene.index.StorableField;
|
||||
|
@ -79,10 +75,10 @@ public class TestCustomDocTransformer extends SolrTestCaseJ4 {
|
|||
public static class CustomTransformerFactory extends TransformerFactory {
|
||||
@Override
|
||||
public DocTransformer create(String field, SolrParams params, SolrQueryRequest req) {
|
||||
Set<String> extra = null;
|
||||
String[] extra = null;
|
||||
String ext = params.get("extra");
|
||||
if(ext!=null) {
|
||||
extra = new HashSet<>(Arrays.asList(Strings.split(ext,',')));
|
||||
extra = Strings.split(ext, ',');
|
||||
}
|
||||
return new CustomTransformer(field, extra);
|
||||
}
|
||||
|
@ -90,10 +86,10 @@ public class TestCustomDocTransformer extends SolrTestCaseJ4 {
|
|||
|
||||
public static class CustomTransformer extends DocTransformer {
|
||||
final String name;
|
||||
final Set<String> extra;
|
||||
final String[] extra;
|
||||
final StringBuilder str = new StringBuilder();
|
||||
|
||||
public CustomTransformer(String name, Set<String> extra) {
|
||||
public CustomTransformer(String name, String[] extra) {
|
||||
this.name = name;
|
||||
this.extra = extra;
|
||||
}
|
||||
|
@ -104,7 +100,7 @@ public class TestCustomDocTransformer extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getExtraRequestFields() {
|
||||
public String[] getExtraRequestFields() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue