Class JsonRenderer

java.lang.Object
com.yahoo.component.AbstractComponent
com.yahoo.processing.rendering.Renderer<RESPONSE>
com.yahoo.processing.rendering.AsynchronousRenderer<RESPONSE>
com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
com.yahoo.search.rendering.JsonRenderer
All Implemented Interfaces:
com.yahoo.component.Component, com.yahoo.component.Deconstructable, Cloneable, Comparable<com.yahoo.component.Component>

public class JsonRenderer extends com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
JSON renderer for search results.
Author:
Steinar Knutsen, bratseth
  • Constructor Details

    • JsonRenderer

      public JsonRenderer()
    • JsonRenderer

      public JsonRenderer(Executor executor)
      Creates a json renderer using a custom executor. Using a custom executor is useful for tests to avoid creating new threads for each renderer registry.
  • Method Details

    • init

      public void init()
      Overrides:
      init in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
    • beginResponse

      public void beginResponse(OutputStream stream) throws IOException
      Specified by:
      beginResponse in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      Throws:
      IOException
    • renderTrace

      protected void renderTrace(com.yahoo.processing.execution.Execution.Trace trace) throws IOException
      Throws:
      IOException
    • beginList

      public void beginList(com.yahoo.processing.response.DataList<?> list) throws IOException
      Specified by:
      beginList in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      Throws:
      IOException
    • moreChildren

      protected void moreChildren() throws IOException
      Throws:
      IOException
    • renderHitGroupHead

      protected void renderHitGroupHead(HitGroup hitGroup) throws IOException
      Throws:
      IOException
    • renderErrors

      protected void renderErrors(Set<ErrorMessage> errors) throws IOException
      Throws:
      IOException
    • renderCoverage

      protected void renderCoverage() throws IOException
      Throws:
      IOException
    • renderHit

      protected void renderHit(Hit hit) throws IOException
      Throws:
      IOException
    • shouldRender

      protected boolean shouldRender(Hit hit)
    • renderHitContents

      protected void renderHitContents(Hit hit) throws IOException
      Throws:
      IOException
    • renderAllFields

      protected void renderAllFields(Hit hit) throws IOException
      Throws:
      IOException
    • renderContinuations

      protected void renderContinuations(Map<String,Continuation> continuations) throws IOException
      Throws:
      IOException
    • renderGroupMetadata

      protected void renderGroupMetadata(GroupId id) throws IOException
      Throws:
      IOException
    • renderTotalHitCount

      protected void renderTotalHitCount(Hit hit) throws IOException
      Throws:
      IOException
    • data

      public void data(com.yahoo.processing.response.Data data) throws IOException
      Specified by:
      data in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      Throws:
      IOException
    • endList

      public void endList(com.yahoo.processing.response.DataList<?> list) throws IOException
      Specified by:
      endList in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      Throws:
      IOException
    • endResponse

      public void endResponse() throws IOException
      Specified by:
      endResponse in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      Throws:
      IOException
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in class com.yahoo.processing.rendering.Renderer<Result>
    • getMimeType

      public String getMimeType()
      Specified by:
      getMimeType in class com.yahoo.processing.rendering.Renderer<Result>
    • createFieldConsumer

      protected JsonRenderer.FieldConsumer createFieldConsumer(boolean debugRendering)
      Override this method to use a custom JsonRenderer.FieldConsumer sub-class to render fields