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 "Anthony Arobone (JIRA)" <ji...@apache.org> on 2007/10/30 23:58:50 UTC

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

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: Anthony Arobone
            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.


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

Posted by "Praveen Shabrish Hari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721721#action_12721721 ] 

Praveen Shabrish Hari commented on SOLR-402:
--------------------------------------------

Could you please provide the patch for latest version Solrj ?

> 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: Minor
>         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.


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

Posted by "Mike Klaas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Klaas updated SOLR-402:
----------------------------

    Fix Version/s:     (was: 1.3)
         Priority: Minor  (was: Blocker)

> 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: Minor
>         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.


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

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543411 ] 

Ryan McKinley commented on SOLR-402:
------------------------------------

It looks like this patch is not really a JSON parser, it is more like a "raw" parser.  Rather then parsing the the response into a NamedList, it just puts the output into the named list:
{panel}
NamedList<Object> named = new NamedList<Object>();
named.add( "json", sb.toString() );
return named;
{panel}

Perhaps what you really want is RawResponseParser that just passes back the string?

If we do a JSON parser, I think it should actually parse the response into a NamedList -- QueryResponse only works if the NamedList is accuratly matched.  

Yonik has an interesting JSON parser at http://svn.apache.org/repos/asf/labs/noggit/ -- perhaps we should try that?

> 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.


[jira] Issue Comment Edited: (SOLR-402) JSON response support

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549683 ] 

ehatcher edited comment on SOLR-402 at 12/8/07 3:00 AM:
------------------------------------------------------------

Here's a more 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?

      was (Author: ehatcher):
    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.


[jira] Issue Comment Edited: (SOLR-402) JSON response support

Posted by "Praveen Shabrish Hari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721721#action_12721721 ] 

Praveen Shabrish Hari edited comment on SOLR-402 at 6/19/09 3:07 AM:
---------------------------------------------------------------------

Could anyone please provide the patch for latest version SolrJ ?

      was (Author: praveen ):
    Could you please provide the patch for latest version Solrj ?
  
> 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: Minor
>         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.


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

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Anthony Arobone (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Arobone updated SOLR-402:
---------------------------------

    Attachment: jsonPatch.patch

json response patch

> 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: Anthony Arobone
>            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.


[jira] Issue Comment Edited: (SOLR-402) JSON response support

Posted by "Praveen Shabrish Hari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721721#action_12721721 ] 

Praveen Shabrish Hari edited comment on SOLR-402 at 6/19/09 3:09 AM:
---------------------------------------------------------------------

Could anyone please provide the patch for latest version SolrJ ?.
In the Previous Release "ResponseParser" was an Interface. Now it has been modified to an Abstract class

      was (Author: praveen ):
    Could anyone please provide the patch for latest version SolrJ ?
  
> 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: Minor
>         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.