public abstract class DocTransformer extends Object
QueryElevationComponent
)
New instance for each request
TransformerFactory
Modifier and Type | Field and Description |
---|---|
protected ResultContext |
context |
Constructor and Description |
---|
DocTransformer() |
Modifier and Type | Method and 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.
|
abstract String |
getName() |
boolean |
needsSolrIndexSearcher()
Indicates if this transformer requires access to the underlying index to perform it's functions.
|
void |
setContext(ResultContext context)
This is called before
transform(org.apache.solr.common.SolrDocument, int, float) to provide context for any subsequent transformations. |
String |
toString() |
abstract void |
transform(SolrDocument doc,
int docid,
float score)
This is where implementations do the actual work.
|
protected ResultContext context
public abstract String getName()
public void setContext(ResultContext context)
transform(org.apache.solr.common.SolrDocument, int, float)
to provide context for any subsequent transformations.context
- The ResultContext
stores information about how the documents were produced.needsSolrIndexSearcher()
public boolean needsSolrIndexSearcher()
setContext(org.apache.solr.response.ResultContext)
to determine if the transformer must be given a "full" ResultContext and accurate docIds
that can be looked up using ResultContext.getSearcher()
, or if optimizations can be taken
advantage of such that ResultContext.getSearcher()
may return null, and docIds passed to
transform(org.apache.solr.common.SolrDocument, int, float)
may be negative.
The default implementation always returns false
.public abstract void transform(SolrDocument doc, int docid, float score) throws IOException
needsSolrIndexSearcher()
method must return truedoc
- The document to alterdocid
- The Lucene internal doc id, or -1 in cases where the doc
did not come from the indexscore
- the score for this documentIOException
- If there is a low-level I/O error.needsSolrIndexSearcher()
public String[] getExtraRequestFields()
SolrIndexSearcher
but may or may not be returned in the final
QueryResponseWriter
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.