SolrJ and RawResponses

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

SolrJ and RawResponses

Grant Ingersoll-2
I want to programmatically retrieve the schema and the config from the  
ShowFileRequestHandler.  I have tried doing it (mostly just to see how  
it would handle it w/o looking at the code) using SolrJ, but get in an  
exception in the XMLResponseParser in SolrJ.  Ideally, I guess SolrJ  
would stuff the big old raw contents into the named list.  Another  
option, would be to add a method to return the raw results.

Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the most  
convenient way, but I suppose I could hack up my own one off for  
HTTPClient.

Thanks,
Grant
Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Ryan McKinley
I think Erik was looking at this earlier...  I think there may be an
open JIRA issue for it, but don't recall which one off the top of my head.

I think you want an ResponseParser that just stuffs the text into the
named list.

If you have any trouble, i can throw something together real quick.

ryan



Grant Ingersoll wrote:

> I want to programmatically retrieve the schema and the config from the
> ShowFileRequestHandler.  I have tried doing it (mostly just to see how
> it would handle it w/o looking at the code) using SolrJ, but get in an
> exception in the XMLResponseParser in SolrJ.  Ideally, I guess SolrJ
> would stuff the big old raw contents into the named list.  Another
> option, would be to add a method to return the raw results.
>
> Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the most
> convenient way, but I suppose I could hack up my own one off for
> HTTPClient.
>
> Thanks,
> Grant
>

Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Grant Ingersoll-2
OK, I will look into it.  setProcessor is only defined for the  
CommonsHttpSolrServer and I am trying to use the abstract SolrServer,  
but I guess I can cast.  Also, the setProcessor isn't great in that it  
isn't thread-safe (i.e. if I am reusing said SolrServer for other  
tasks in other threads).  Would adding an request() method that takes  
in a ResponseParser make sense?

-Grant

On Feb 8, 2008, at 4:14 PM, Ryan McKinley wrote:

> I think Erik was looking at this earlier...  I think there may be an  
> open JIRA issue for it, but don't recall which one off the top of my  
> head.
>
> I think you want an ResponseParser that just stuffs the text into  
> the named list.
>
> If you have any trouble, i can throw something together real quick.
>
> ryan
>
>
>
> Grant Ingersoll wrote:
>> I want to programmatically retrieve the schema and the config from  
>> the ShowFileRequestHandler.  I have tried doing it (mostly just to  
>> see how it would handle it w/o looking at the code) using SolrJ,  
>> but get in an exception in the XMLResponseParser in SolrJ.  
>> Ideally, I guess SolrJ would stuff the big old raw contents into  
>> the named list.  Another option, would be to add a method to return  
>> the raw results.
>> Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the  
>> most convenient way, but I suppose I could hack up my own one off  
>> for HTTPClient.
>> Thanks,
>> Grant
>


Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Yonik Seeley-2
On Feb 8, 2008 4:27 PM, Grant Ingersoll <[hidden email]> wrote:
> OK, I will look into it.  setProcessor is only defined for the
> CommonsHttpSolrServer and I am trying to use the abstract SolrServer,
> but I guess I can cast.  Also, the setProcessor isn't great in that it
> isn't thread-safe (i.e. if I am reusing said SolrServer for other
> tasks in other threads).  Would adding an request() method that takes
> in a ResponseParser make sense?

Or adding a response parser to SolrRequest perhaps?

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Grant Ingersoll-2
In reply to this post by Ryan McKinley
btw, is https://issues.apache.org/jira/browse/SOLR-402 the issue you  
were referring to?

-Grant

On Feb 8, 2008, at 4:14 PM, Ryan McKinley wrote:

> I think Erik was looking at this earlier...  I think there may be an  
> open JIRA issue for it, but don't recall which one off the top of my  
> head.
>
> I think you want an ResponseParser that just stuffs the text into  
> the named list.
>
> If you have any trouble, i can throw something together real quick.
>
> ryan
>
>
>
> Grant Ingersoll wrote:
>> I want to programmatically retrieve the schema and the config from  
>> the ShowFileRequestHandler.  I have tried doing it (mostly just to  
>> see how it would handle it w/o looking at the code) using SolrJ,  
>> but get in an exception in the XMLResponseParser in SolrJ.  
>> Ideally, I guess SolrJ would stuff the big old raw contents into  
>> the named list.  Another option, would be to add a method to return  
>> the raw results.
>> Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the  
>> most convenient way, but I suppose I could hack up my own one off  
>> for HTTPClient.
>> Thanks,
>> Grant
>


Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Ryan McKinley
In reply to this post by Grant Ingersoll-2
what about extending CommonsHttpSolrServer and setting the _processor in
the constructor?

I guess it depends on how things will be used.

ryan


Grant Ingersoll wrote:

> OK, I will look into it.  setProcessor is only defined for the
> CommonsHttpSolrServer and I am trying to use the abstract SolrServer,
> but I guess I can cast.  Also, the setProcessor isn't great in that it
> isn't thread-safe (i.e. if I am reusing said SolrServer for other tasks
> in other threads).  Would adding an request() method that takes in a
> ResponseParser make sense?
>
> -Grant
>
> On Feb 8, 2008, at 4:14 PM, Ryan McKinley wrote:
>
>> I think Erik was looking at this earlier...  I think there may be an
>> open JIRA issue for it, but don't recall which one off the top of my
>> head.
>>
>> I think you want an ResponseParser that just stuffs the text into the
>> named list.
>>
>> If you have any trouble, i can throw something together real quick.
>>
>> ryan
>>
>>
>>
>> Grant Ingersoll wrote:
>>> I want to programmatically retrieve the schema and the config from
>>> the ShowFileRequestHandler.  I have tried doing it (mostly just to
>>> see how it would handle it w/o looking at the code) using SolrJ, but
>>> get in an exception in the XMLResponseParser in SolrJ.  Ideally, I
>>> guess SolrJ would stuff the big old raw contents into the named
>>> list.  Another option, would be to add a method to return the raw
>>> results.
>>> Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the
>>> most convenient way, but I suppose I could hack up my own one off for
>>> HTTPClient.
>>> Thanks,
>>> Grant
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Grant Ingersoll-2
In reply to this post by Yonik Seeley-2

On Feb 8, 2008, at 4:39 PM, Yonik Seeley wrote:

> On Feb 8, 2008 4:27 PM, Grant Ingersoll <[hidden email]> wrote:
>> OK, I will look into it.  setProcessor is only defined for the
>> CommonsHttpSolrServer and I am trying to use the abstract SolrServer,
>> but I guess I can cast.  Also, the setProcessor isn't great in that  
>> it
>> isn't thread-safe (i.e. if I am reusing said SolrServer for other
>> tasks in other threads).  Would adding an request() method that takes
>> in a ResponseParser make sense?
>
> Or adding a response parser to SolrRequest perhaps?
>

Does a ResponseParser make sense for all SolrRequest objects?  
Presumably, the reason setProcessor() isn't on SolrServer is b/c it  
isn't needed for embedded, right?

I think that CommonsHttpSolrServer could be mod'ed to:
@Override
   public NamedList<Object> request( final SolrRequest request )  
throws SolrServerException, IOException
   {
     return request(request, _processor);
   }


   public NamedList<Object> request(final SolrRequest request,  
ResponseParser processor) throws SolrServerException, IOException{
   ...

I have a patch ready to go if people think it is worthwhile.

-Grant


Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Ryan McKinley
In reply to this post by Grant Ingersoll-2
Grant Ingersoll wrote:
> btw, is https://issues.apache.org/jira/browse/SOLR-402 the issue you
> were referring to?
>

yes.



> -Grant
>
> On Feb 8, 2008, at 4:14 PM, Ryan McKinley wrote:
>
>> I think Erik was looking at this earlier...  I think there may be an
>> open JIRA issue for it, but don't recall which one off the top of my
>> head.
>>
>> I think you want an ResponseParser that just stuffs the text into the
>> named list.
>>
>> If you have any trouble, i can throw something together real quick.
>>
>> ryan
>>
>>
>>
>> Grant Ingersoll wrote:
>>> I want to programmatically retrieve the schema and the config from
>>> the ShowFileRequestHandler.  I have tried doing it (mostly just to
>>> see how it would handle it w/o looking at the code) using SolrJ, but
>>> get in an exception in the XMLResponseParser in SolrJ.  Ideally, I
>>> guess SolrJ would stuff the big old raw contents into the named
>>> list.  Another option, would be to add a method to return the raw
>>> results.
>>> Any thoughts?  Am I doing this the wrong way?  Using SolrJ is the
>>> most convenient way, but I suppose I could hack up my own one off for
>>> HTTPClient.
>>> Thanks,
>>> Grant
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Ryan McKinley
In reply to this post by Grant Ingersoll-2
Thinking about this some more...  yes, the SolrRequest should say what
parser is used.  It is the request that has to deal with the output in
the end.

Any change here need to make sure to address lines 125,126 of
CommonsHttpSolrServer
  _invariantParams.set( CommonParams.WT, _processor.getWriterType() );

ryan


Grant Ingersoll wrote:

>
> On Feb 8, 2008, at 4:39 PM, Yonik Seeley wrote:
>
>> On Feb 8, 2008 4:27 PM, Grant Ingersoll <[hidden email]> wrote:
>>> OK, I will look into it.  setProcessor is only defined for the
>>> CommonsHttpSolrServer and I am trying to use the abstract SolrServer,
>>> but I guess I can cast.  Also, the setProcessor isn't great in that it
>>> isn't thread-safe (i.e. if I am reusing said SolrServer for other
>>> tasks in other threads).  Would adding an request() method that takes
>>> in a ResponseParser make sense?
>>
>> Or adding a response parser to SolrRequest perhaps?
>>
>
> Does a ResponseParser make sense for all SolrRequest objects?  
> Presumably, the reason setProcessor() isn't on SolrServer is b/c it
> isn't needed for embedded, right?
>
> I think that CommonsHttpSolrServer could be mod'ed to:
> @Override
>   public NamedList<Object> request( final SolrRequest request ) throws
> SolrServerException, IOException
>   {
>     return request(request, _processor);
>   }
>
>
>   public NamedList<Object> request(final SolrRequest request,
> ResponseParser processor) throws SolrServerException, IOException{
>   ...
>
> I have a patch ready to go if people think it is worthwhile.
>
> -Grant
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: SolrJ and RawResponses

Yonik Seeley-2
On Feb 8, 2008 5:13 PM, Ryan McKinley <[hidden email]> wrote:
> Thinking about this some more...  yes, the SolrRequest should say what
> parser is used.  It is the request that has to deal with the output in
> the end.

I could see it either way really... passed as a param to request() or
as an optional param on SolrRequest.

-Yonik