@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.
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.
|
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
|
createContext, dumpAndXMLQuoteUTF8, dumpBytes, isDefaultTemplateSet, queryContext
getBoldCloseTag, getBoldOpenTag, getEncoding, getMimeType, getName, getRequestedEncoding, getSeparatorTag, getSummaryClass, getTemplate, setHighlightTags, setSummaryClass, setTemplate, setTemplateNotNull
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 writerpublic 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)
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 hitpublic void noHits(Context context, com.yahoo.text.XMLWriter writer)
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 hitprotected static void renderCoverageAttributes(Coverage coverage, com.yahoo.text.XMLWriter writer)
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)
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
protected void renderField(Context context, Hit hit, Map.Entry<String,Object> entry, com.yahoo.text.XMLWriter writer) throws IOException
IOException
protected void renderFieldContent(Context context, Hit hit, String name, com.yahoo.text.XMLWriter writer)
Copyright © 2018. All rights reserved.