Class RenameFieldTransformer
- java.lang.Object
-
- org.apache.solr.response.transform.DocTransformer
-
- org.apache.solr.response.transform.RenameFieldTransformer
-
public class RenameFieldTransformer extends DocTransformer
Return a field with a name that is different that what is indexed- Since:
- solr 4.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.response.transform.DocTransformer
DocTransformer.NoopFieldTransformer
-
-
Field Summary
-
Fields inherited from class org.apache.solr.response.transform.DocTransformer
context
-
-
Constructor Summary
Constructors Constructor Description RenameFieldTransformer(String from, String to, boolean copy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getExtraRequestFields()
When a transformer needs access to fields that are not automatically derived from the input fields names, this option lets us explicitly say the field names that we hope will be in the SolrDocument.String
getName()
void
transform(org.apache.solr.common.SolrDocument doc, int docid)
This is where implementations do the actual work.-
Methods inherited from class org.apache.solr.response.transform.DocTransformer
getRawFields, needsSolrIndexSearcher, setContext, toString, transform
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in classDocTransformer
- Returns:
- The name of the transformer
-
transform
public void transform(org.apache.solr.common.SolrDocument doc, int docid)
Description copied from class:DocTransformer
This is where implementations do the actual work. If implementations require a valid docId and index access, theDocTransformer.needsSolrIndexSearcher()
method must return true- Specified by:
transform
in classDocTransformer
- Parameters:
doc
- The document to alterdocid
- The Lucene internal doc id, or -1 in cases where thedoc
did not come from the index- See Also:
DocTransformer.needsSolrIndexSearcher()
-
getExtraRequestFields
public String[] getExtraRequestFields()
Description copied from class:DocTransformer
When a transformer needs access to fields that are not automatically 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 theSolrIndexSearcher
but may or may not be returned in the finalQueryResponseWriter
- Overrides:
getExtraRequestFields
in classDocTransformer
- Returns:
- a list of extra lucene fields
-
-