Class DocTransformers
- java.lang.Object
-
- org.apache.solr.response.transform.DocTransformer
-
- org.apache.solr.response.transform.DocTransformers
-
public class DocTransformers extends DocTransformer
Transform a document before it gets sent out
-
-
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 DocTransformers()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransformer(DocTransformer a)
String
getName()
Collection<String>
getRawFields()
If this transformer wants to bypass escaping in theTextResponseWriter
and write content directly to output for certain field(s), the names of any such field(s) should be returnedDocTransformer
getTransformer(int idx)
boolean
needsSolrIndexSearcher()
Returns true if and only if at least 1 child transformer returns truevoid
setContext(ResultContext context)
This is called beforeDocTransformer.transform(org.apache.solr.common.SolrDocument, int, float)
to provide context for any subsequent transformations.int
size()
void
transform(org.apache.solr.common.SolrDocument doc, int docid)
This is where implementations do the actual work.void
transform(org.apache.solr.common.SolrDocument doc, int docid, float score)
This is where implementations do the actual work.-
Methods inherited from class org.apache.solr.response.transform.DocTransformer
getExtraRequestFields, toString
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in classDocTransformer
- Returns:
- The name of the transformer
-
getRawFields
public Collection<String> getRawFields()
Description copied from class:DocTransformer
If this transformer wants to bypass escaping in theTextResponseWriter
and write content directly to output for certain field(s), the names of any such field(s) should be returnedNOTE: normally this will be conditional on the `wt` param in the request, as supplied to the
DocTransformer
's parentTransformerFactory
at the time of transformer creation.- Overrides:
getRawFields
in classDocTransformer
- Returns:
- Collection containing field names to be written raw; if no field names should be
written raw, an empty collection should be returned. Any collection returned collection
need not be externally modifiable -- i.e.,
Collections.singleton(Object)
is acceptable.
-
addTransformer
public void addTransformer(DocTransformer a)
-
size
public int size()
-
getTransformer
public DocTransformer getTransformer(int idx)
-
setContext
public void setContext(ResultContext context)
Description copied from class:DocTransformer
This is called beforeDocTransformer.transform(org.apache.solr.common.SolrDocument, int, float)
to provide context for any subsequent transformations.- Overrides:
setContext
in classDocTransformer
- Parameters:
context
- TheResultContext
stores information about how the documents were produced.- See Also:
DocTransformer.needsSolrIndexSearcher()
-
transform
public void transform(org.apache.solr.common.SolrDocument doc, int docid, float score) throws IOException
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 trueDefault implementation calls
DocTransformer.transform(SolrDocument, int)
.- Overrides:
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 indexscore
- the score for this document- Throws:
IOException
- If there is a low-level I/O error.- See Also:
DocTransformer.needsSolrIndexSearcher()
-
transform
public void transform(org.apache.solr.common.SolrDocument doc, int docid) throws IOException
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- Throws:
IOException
- If there is a low-level I/O error.- See Also:
DocTransformer.needsSolrIndexSearcher()
-
needsSolrIndexSearcher
public boolean needsSolrIndexSearcher()
Returns true if and only if at least 1 child transformer returns true- Overrides:
needsSolrIndexSearcher
in classDocTransformer
- See Also:
ResultContext.getSearcher()
,DocTransformer.transform(org.apache.solr.common.SolrDocument, int, float)
-
-