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
  • Constructor Details

    • RenameFieldTransformer

      public RenameFieldTransformer(String from, String to, boolean copy)
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in class DocTransformer
      Returns:
      The name of the transformer
    • transform

      public void transform(org.apache.solr.common.SolrDocument doc, int docid, DocIterationInfo docInfo)
      Description copied from class: DocTransformer
      This is where implementations do the actual work. If implementations require a valid docId and index access, the DocTransformer.needsSolrIndexSearcher() method must return true
      Specified by:
      transform in class DocTransformer
      Parameters:
      doc - The document to alter
      docid - The Lucene internal doc id, or -1 in cases where the doc did not come from the index
      docInfo - the document information for this document, including the score. Do not pass null, instead use DocIterationInfo.NONE.
      See Also:
    • 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 the SolrIndexSearcher but may or may not be returned in the final QueryResponseWriter
      Overrides:
      getExtraRequestFields in class DocTransformer
      Returns:
      a list of extra lucene fields