You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Erik Hatcher (JIRA)" <ji...@apache.org> on 2007/12/08 12:01:43 UTC

[jira] Commented: (SOLR-402) JSON response support

    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549683 ] 

Erik Hatcher commented on SOLR-402:
-----------------------------------

Here's a ore general purpose ResponseParser implementation.

{code}
public class RawResponseParser implements ResponseParser {
  private String writerType;

  public RawResponseParser(String writerType) {
    this.writerType = writerType;
  }

  public String getWriterType() {
    return writerType;
  }

  public NamedList<Object> processResponse(Reader in) {
    NamedList<Object> data = new NamedList<Object>();
    try {
      StringBuffer raw = new StringBuffer();
      char[] b = new char[16384];
      int n;

      // Read a block. If it gets any chars, append them.
      while ((n = in.read(b)) > 0) {
        raw.append(b, 0, n);
      }


      data.add("raw", raw.toString());
    } catch (IOException e) {
      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "parsing error", e);
    }

    return data;
  }
}
{code}

Perhaps instead of "raw" it could use writerType as the key value?

> JSON response support
> ---------------------
>
>                 Key: SOLR-402
>                 URL: https://issues.apache.org/jira/browse/SOLR-402
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>    Affects Versions: 1.3
>         Environment: all
>            Reporter: AABones
>            Priority: Blocker
>             Fix For: 1.3
>
>         Attachments: jsonPatch.patch
>
>
> The Solrj java client was missing response support for JSON.  I added an JSONResponseParser class and the necessary changes elsewhere to support it.  I'm attaching the patch file. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.