@Deprecated public class DefaultTemplateSet extends UserTemplate<com.yahoo.text.XMLWriter>
A template set which provides XML rendering of results and hits.
This can be extended to create custom programmatic templates. Create a subclass which has static inner classes extending DefaultTemplate for the templates you wish to override and call the set method for those templates in the subclass template set constructor. Some of the default templates contained utility functions, and can be overridden in place of DefaultTemplate to gain access to these. See TiledTemplateSet for an example.
Modifier and Type | Field and Description |
---|---|
private static com.yahoo.text.Utf8String |
CODE
Deprecated.
|
private static com.yahoo.text.Utf8String |
COVERAGE
Deprecated.
|
private static com.yahoo.text.Utf8String |
COVERAGE_DOCS
Deprecated.
|
private static com.yahoo.text.Utf8String |
COVERAGE_FULL
Deprecated.
|
private static com.yahoo.text.Utf8String |
COVERAGE_NODES
Deprecated.
|
private static com.yahoo.text.Utf8String |
ERROR
Deprecated.
|
private static com.yahoo.text.Utf8String |
FIELD
Deprecated.
|
private com.yahoo.concurrent.CopyOnWriteHashMap<String,com.yahoo.text.Utf8String> |
fieldNameMap
Deprecated.
|
private static com.yahoo.text.Utf8String |
GROUP
Deprecated.
|
private static com.yahoo.text.Utf8String |
HIT
Deprecated.
|
private static com.yahoo.text.Utf8String |
ID
Deprecated.
|
private static com.yahoo.text.Utf8String |
NAME
Deprecated.
|
private static com.yahoo.text.Utf8String |
QUERY_TIME
Deprecated.
|
private static com.yahoo.text.Utf8String |
RELEVANCY
Deprecated.
|
private static com.yahoo.text.Utf8String |
RESULT
Deprecated.
|
private static com.yahoo.text.Utf8String |
RESULTS
Deprecated.
|
private static com.yahoo.text.Utf8String |
RESULTS_FULL
Deprecated.
|
private static com.yahoo.text.Utf8String |
SEARCH_TIME
Deprecated.
|
private static com.yahoo.text.Utf8String |
SOURCE
Deprecated.
|
private static com.yahoo.text.Utf8String |
SUMMARY_FETCH_TIME
Deprecated.
|
private static com.yahoo.text.Utf8String |
TOTAL_HIT_COUNT
Deprecated.
|
private static com.yahoo.text.Utf8String |
TYPE
Deprecated.
|
DEFAULT_ENCODING, DEFAULT_MIMETYPE
Modifier | Constructor and Description |
---|---|
|
DefaultTemplateSet()
Deprecated.
|
protected |
DefaultTemplateSet(String name)
Deprecated.
Create a template set with a name.
|
Modifier and Type | Method and Description |
---|---|
void |
error(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Render the error message for a result set.
|
void |
footer(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Render the result set footer.
|
void |
header(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Render the result set header.
|
void |
hit(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Render a single top level hit.
|
void |
hitFooter(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Render a footer for a single top level hit.
|
void |
noHits(Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Invoked when the result set has no hits.
|
protected static void |
renderCoverageAttributes(Coverage coverage,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
protected void |
renderField(Context context,
Hit hit,
Map.Entry<String,Object> entry,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
protected void |
renderFieldContent(Context context,
Hit hit,
String name,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
protected void |
renderGroup(HitGroup hit,
com.yahoo.text.XMLWriter writer)
Deprecated.
Renders a hit group.
|
protected void |
renderHitAttributes(Hit hit,
com.yahoo.text.XMLWriter writer)
Deprecated.
Writes a hit's default attributes like 'type', 'source', 'relevancy'.
|
protected void |
renderHitFields(Context context,
Hit hit,
com.yahoo.text.XMLWriter writer)
Deprecated.
Renders all fields of a hit.
|
protected void |
renderHitGroup(HitGroup hit,
Context context,
com.yahoo.text.XMLWriter writer)
Deprecated.
Opens (but does not close) the group hit tag
|
protected void |
renderHitGroupOfTypeGroupHit(Context context,
HitGroup hit,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
protected void |
renderId(com.yahoo.net.URI uri,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
private void |
renderSimpleField(String fieldName,
Object fieldValue,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
private void |
renderSyntheticRelevancyField(Hit hit,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
private void |
renderTime(com.yahoo.text.XMLWriter writer,
Result result)
Deprecated.
|
protected boolean |
shouldRenderField(Hit hit,
String fieldName)
Deprecated.
Returns whether a field should be rendered.
|
com.yahoo.text.XMLWriter |
wrapWriter(Writer writer)
Deprecated.
Uses an XML writer in this template
|
private void |
writeCloseFieldElement(com.yahoo.text.XMLWriter writer)
Deprecated.
|
private void |
writeOpenFieldElement(String fieldName,
com.yahoo.text.XMLWriter writer)
Deprecated.
|
createContext, dumpAndXMLQuoteUTF8, dumpBytes, isDefaultTemplateSet, queryContext
getBoldCloseTag, getBoldOpenTag, getEncoding, getMimeType, getName, getRequestedEncoding, getSeparatorTag, getSummaryClass, getTemplate, setHighlightTags, setSummaryClass, setTemplate, setTemplateNotNull
private static final com.yahoo.text.Utf8String RESULT
private static final com.yahoo.text.Utf8String GROUP
private static final com.yahoo.text.Utf8String ID
private static final com.yahoo.text.Utf8String FIELD
private static final com.yahoo.text.Utf8String HIT
private static final com.yahoo.text.Utf8String ERROR
private static final com.yahoo.text.Utf8String TOTAL_HIT_COUNT
private static final com.yahoo.text.Utf8String QUERY_TIME
private static final com.yahoo.text.Utf8String SUMMARY_FETCH_TIME
private static final com.yahoo.text.Utf8String SEARCH_TIME
private static final com.yahoo.text.Utf8String NAME
private static final com.yahoo.text.Utf8String CODE
private static final com.yahoo.text.Utf8String COVERAGE_DOCS
private static final com.yahoo.text.Utf8String COVERAGE_NODES
private static final com.yahoo.text.Utf8String COVERAGE_FULL
private static final com.yahoo.text.Utf8String COVERAGE
private static final com.yahoo.text.Utf8String RESULTS_FULL
private static final com.yahoo.text.Utf8String RESULTS
private static final com.yahoo.text.Utf8String TYPE
private static final com.yahoo.text.Utf8String RELEVANCY
private static final com.yahoo.text.Utf8String SOURCE
private final com.yahoo.concurrent.CopyOnWriteHashMap<String,com.yahoo.text.Utf8String> fieldNameMap
protected DefaultTemplateSet(String name)
public DefaultTemplateSet()
public com.yahoo.text.XMLWriter wrapWriter(Writer writer)
wrapWriter
in class UserTemplate<com.yahoo.text.XMLWriter>
public void header(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result".
header
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the resultIOException
- may be propagated from the writerprivate void renderTime(com.yahoo.text.XMLWriter writer, Result result)
public void footer(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result".
footer
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the resultIOException
- may be propagated from the writerpublic void hit(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result". The hit itself as "hit", the index of the hit as "hitno", and all the fields under their normal names.
hit
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, the hit
instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic void hitFooter(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result". The hit itself as "hit", the index of the hit as "hitno", and all the fields under their normal names.
hitFooter
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, the hit
instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic void error(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result".
error
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, main error
and result set instances.writer
- the destination for rendering the hitIOException
- may be propagated from the writerpublic void noHits(Context context, com.yahoo.text.XMLWriter writer) throws IOException
UserTemplate
The result set is available in the context object under the name "result".
noHits
in class UserTemplate<com.yahoo.text.XMLWriter>
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerprotected static void renderCoverageAttributes(Coverage coverage, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderHitAttributes(Hit hit, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderHitGroup(HitGroup hit, Context context, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderGroup(HitGroup hit, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderHitGroupOfTypeGroupHit(Context context, HitGroup hit, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderId(com.yahoo.net.URI uri, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderHitFields(Context context, Hit hit, com.yahoo.text.XMLWriter writer) throws IOException
renderField(Context, Hit, java.util.Map.Entry, XMLWriter)
for every field.IOException
private void renderSyntheticRelevancyField(Hit hit, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderField(Context context, Hit hit, Map.Entry<String,Object> entry, com.yahoo.text.XMLWriter writer) throws IOException
IOException
private void writeOpenFieldElement(String fieldName, com.yahoo.text.XMLWriter writer) throws IOException
IOException
private void writeCloseFieldElement(com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderFieldContent(Context context, Hit hit, String name, com.yahoo.text.XMLWriter writer) throws IOException
IOException
private void renderSimpleField(String fieldName, Object fieldValue, com.yahoo.text.XMLWriter writer) throws IOException
IOException
Copyright © 2017. All rights reserved.