org.apache.solr.response.transform
Class DocTransformer

java.lang.Object
  extended by org.apache.solr.response.transform.DocTransformer
Direct Known Subclasses:
DocTransformers, RenameFieldTransformer, TransformerWithContext, ValueSourceAugmenter

public abstract class DocTransformer
extends Object

A DocTransformer can add, remove or alter a Document before it is written out to the Response. For instance, there are implementations that can put explanations inline with a document, add constant values and mark items as being artificially boosted (see QueryElevationComponent)

New instance for each request

See Also:
TransformerFactory

Constructor Summary
DocTransformer()
           
 
Method Summary
abstract  String getName()
           
 void setContext(TransformContext context)
          This is called before transform and sets
 String toString()
           
abstract  void transform(SolrDocument doc, int docid)
          This is where implementations do the actual work
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocTransformer

public DocTransformer()
Method Detail

getName

public abstract String getName()
Returns:
The name of the transformer

setContext

public void setContext(TransformContext context)
This is called before transform and sets

Parameters:
context - The TransformContext stores information about the current state of things in Solr that may be useful for doing transformations.

transform

public abstract void transform(SolrDocument doc,
                               int docid)
                        throws IOException
This is where implementations do the actual work

Parameters:
doc - The document to alter
docid - The Lucene internal doc id
Throws:
IOException - If there is a low-level I/O error.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.