RE: Solrj question

2012-12-11 Thread Steve Molloy
Done, SOLR-4166. :)

Again, thanks for the help.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 11, 2012 2:28 AM
To: dev@lucene.apache.org
Subject: Re: Solrj question

Glad to hear that it helped. But this is very hacky, and there is no guarantee 
that it will work with next release, so if you want better and more clean 
support for what you are trying to do, you probably want to open a ticket for 
it, solve it and cover it by tests, so that no one breaks the feature.

Regards, Per Steffensen

Steve Molloy skrev:
Thanks, I had to extend the LBHttpSolrServer so that it acknowledges the null 
parser I specify (always uses binary :(). But basically, I now have support by 
setting my custom LBHttpSolrServer with a null parser.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 04, 2012 3:29 PM
To: dev@lucene.apache.orgmailto:dev@lucene.apache.org
Subject: Re: Solrj question

Steve Molloy skrev:
I really hate duplicating code
I love you :-)


Unless there's a way to get the original message before it's unmarshaled into 
the QueryResponse, in which case I'd be more than happy to use that as-is. :)
Ha ha. Just had a short look at the code, and tried to hack it, but got tired, 
so I didnt complete or test it. But maybe this will help you (completely 
untested - dont even know if it will compile):

CloudSolrServer client = new 
CloudSolrServer(zk-connect-string, new LBHttpSolrServer(null) {
@Override
protected HttpSolrServer makeServer(String baseUrl) 
throws MalformedURLException {
return new HttpSolrServer(baseUrl, getHttpClient(), 
null) {
@Override
public NamedListObject request(final 
SolrRequest request) throws SolrServerException, IOException{
return request(request, null);
}
};
}
});
InputStream responseDirectlyFromWire = 
(InputStream)client.query(query).getResponse().get(stream);

inline: image001.gifinline: image002.gif

RE: Solrj question

2012-12-11 Thread Steve Molloy
Which apparently just got resolved... Who was talking about patches taking a 
long time to get in? :P

Thanks Mark!

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Steve Molloy [mailto:smol...@opentext.com]
Sent: Tuesday, December 11, 2012 1:52 PM
To: dev@lucene.apache.org
Subject: RE: Solrj question

Done, SOLR-4166. :)

Again, thanks for the help.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 11, 2012 2:28 AM
To: dev@lucene.apache.org
Subject: Re: Solrj question

Glad to hear that it helped. But this is very hacky, and there is no guarantee 
that it will work with next release, so if you want better and more clean 
support for what you are trying to do, you probably want to open a ticket for 
it, solve it and cover it by tests, so that no one breaks the feature.

Regards, Per Steffensen

Steve Molloy skrev:
Thanks, I had to extend the LBHttpSolrServer so that it acknowledges the null 
parser I specify (always uses binary :(). But basically, I now have support by 
setting my custom LBHttpSolrServer with a null parser.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 04, 2012 3:29 PM
To: dev@lucene.apache.orgmailto:dev@lucene.apache.org
Subject: Re: Solrj question

Steve Molloy skrev:
I really hate duplicating code
I love you :-)

Unless there's a way to get the original message before it's unmarshaled into 
the QueryResponse, in which case I'd be more than happy to use that as-is. :)
Ha ha. Just had a short look at the code, and tried to hack it, but got tired, 
so I didnt complete or test it. But maybe this will help you (completely 
untested - dont even know if it will compile):

CloudSolrServer client = new 
CloudSolrServer(zk-connect-string, new LBHttpSolrServer(null) {
@Override
protected HttpSolrServer makeServer(String baseUrl) 
throws MalformedURLException {
return new HttpSolrServer(baseUrl, getHttpClient(), 
null) {
@Override
public NamedListObject request(final 
SolrRequest request) throws SolrServerException, IOException{
return request(request, null);
}
};
}
});
InputStream responseDirectlyFromWire = 
(InputStream)client.query(query).getResponse().get(stream);

inline: image001.gifinline: image002.gif

RE: Solrj question

2012-12-10 Thread Steve Molloy
Thanks, this actually replaces the wt parameter (to noop for instance), so 
prevents me from supporting multiple formats as well. I got it to work though, 
using null parser in a custom LBHttpSolrServer (current one seems to ignore 
parser and use binary all the time).

Steve Molloy
Content Analytics Lead  |  RD
Phone:
(514) 908-5406 406
Website:
www.opentext.com


 
 

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein


-Original Message-
From: Chris Hostetter [mailto:hossman_luc...@fucit.org] 
Sent: Tuesday, December 04, 2012 8:39 PM
To: dev@lucene.apache.org
Subject: Re: Solrj question


: Believe there are no setParser method on CloudSolrServer?

I'm not sure why CloudSolrServer doesn't let you specify the parser ... i 
would suggest filing a feature request to make that possible.

Even assuming you have that, Erick's suggestion isn't quite what you 
want...

:  haven't tried this personally, but try this:
:  server.setParser(new XMLResponseParser());

...because that tells the SolrServer instance to use the XMLResponseParser 
to parse the data into a QueryResponse.

What you want is essentially to write your own ResponesParser that doesn't 
do any parsing, and just returns a pointer to the the InputStream it's 
given.

Assuming you have that, it may not matter that CloudSolrServer doesn't let 
you specify a default RequestParser, you *should* be able to just call 
SolrRequest.setResponseParser() to force your specific parser to be used 
(but i haven't sanity checked that works with CloudSolrServer)


-Hoss

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



RE: Solrj question

2012-12-10 Thread Steve Molloy
Thanks, I had to extend the LBHttpSolrServer so that it acknowledges the null 
parser I specify (always uses binary :(). But basically, I now have support by 
setting my custom LBHttpSolrServer with a null parser.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 04, 2012 3:29 PM
To: dev@lucene.apache.org
Subject: Re: Solrj question

Steve Molloy skrev:
I really hate duplicating code
I love you :-)

Unless there's a way to get the original message before it's unmarshaled into 
the QueryResponse, in which case I'd be more than happy to use that as-is. :)
Ha ha. Just had a short look at the code, and tried to hack it, but got tired, 
so I didnt complete or test it. But maybe this will help you (completely 
untested - dont even know if it will compile):

CloudSolrServer client = new 
CloudSolrServer(zk-connect-string, new LBHttpSolrServer(null) {
@Override
protected HttpSolrServer makeServer(String baseUrl) 
throws MalformedURLException {
return new HttpSolrServer(baseUrl, getHttpClient(), 
null) {
@Override
public NamedListObject request(final 
SolrRequest request) throws SolrServerException, IOException{
return request(request, null);
}
};
}
});
InputStream responseDirectlyFromWire = 
(InputStream)client.query(query).getResponse().get(stream);
inline: image001.gifinline: image002.gif

Re: Solrj question

2012-12-10 Thread Per Steffensen




Glad to hear that it helped. But this is very hacky, and there is no
guarantee that it will work with next release, so if you want "better"
and more clean support for what you are trying to do, you probably want
to open a ticket for it, solve it and cover it by tests, so that no one
breaks the feature.

Regards, Per Steffensen

Steve Molloy skrev:

  
  

  
  
  Thanks,
I had to extend the LBHttpSolrServer so that it acknowledges the null
parser I specify (always uses binary
  L).
But basically, I now have support by setting my custom LBHttpSolrServer
with a null parser.
  
  
  
  

  

Steve
Molloy
Content
Analytics Lead | RD

  
  


  

  
  Phone:
  
  
  (514)
908-5406 406
  


  
  Website:
  
  
  www.opentext.com
  

  


  
  










  

  
  We
cant solve problems by using the same kind of thinking we used when we
created them.
  Attributed
to Albert Einstein
  
  
  
  
  From:
Per Steffensen [mailto:st...@designware.dk]
  
  Sent: Tuesday, December 04, 2012 3:29 PM
  To: dev@lucene.apache.org
  Subject: Re: Solrj question
  
  
  
  Steve Molloy skrev: 
  I
really hate duplicating code
  I love you :-)
  
  
  Unless
theres a way to get the original message before its unmarshaled into
the QueryResponse, in which case Id be more than happy to use that
as-is.
  J
  
  Ha ha. Just had a
short look at the code, and tried to hack it, but got tired, so I didnt
complete or test it. But maybe this will help you (completely untested
- dont even know if it will compile):
  
 CloudSolrServer client = new
CloudSolrServer(zk-connect-string, new LBHttpSolrServer(null) {
  @Override
  protected HttpSolrServer makeServer(String
baseUrl) throws MalformedURLException {
   return new HttpSolrServer(baseUrl,
getHttpClient(), null) {
@Override
public NamedListObject
request(final SolrRequest request) throws SolrServerException,
IOException {
 return request(request, null);
}
   };
  }
 });
 InputStream responseDirectlyFromWire =
(InputStream)client.query(query).getResponse().get("stream");
  






Re: Solrj question

2012-12-04 Thread Per Steffensen




Believe there are no setParser method on CloudSolrServer? 

Have you tried this:
XMLWriter.writeResponse(a java.io.Writer for your XML output,
your SolrQueryRequest, your SolrQueryResponse)
It will require you to include solr-core, since that is where XMLWriter
lives.

But it is a little inefficient, if I understand you correctly. If you
have a CloudSolrServer doing a request and asks for a response in e.g.
XML format, then this CloudSolrServer will receive a XML response over
the wire, parse it into a SolrQueryResponse object and then you will
take that SolrQueryResponse and serialize it back to XML. It would be
nicer if you just used whatever was received on the wire directly.

Regards, Per Steffensen

Erick Erickson skrev:
haven't tried this personally, but try this:
  
  server.setParser(new XMLResponseParser());
  
  
  Best
  Erick
  
  
  
  On Mon, Dec 3, 2012 at 10:24 AM, Steve
Molloy smol...@opentext.com
wrote:
  


I’ve been digging around a bit and could not
find any straight-forward way of getting back the XML response after
calling Solr using Solrj. The query method returns a QueryResponse
object, which is great in most cases. But our use case implies pushing
the response back to whatever format was requested, but still use the
CloudSolrServer client. This is very easy with the javabin format,
using the JavaBinCodec, but is there equivalent utilities to marshal
into other formats from a NamedList? Otherwise, could the functionality
be isolated for better reuse?
 
Thanks,
 

  

  
  Steve
Molloy
  Content
Analytics Lead  |  RD
  


  
  

  

Phone:


(514) 908-5406 406

  
  

Website:


www.opentext.com

  

  
  

  



Nstein is
now OpenText.
Please update your address book with my new email address.


This
email message is confidential, may be privileged, and is intended for
the exclusive use of the addressee. Any other person is strictly
prohibited from disclosing or reproducing it. If the addressee cannot
be reached or is unknown to you, please inform the sender by return
email and delete this email message and all copies immediately.
 


  
  
  
  






RE: Solrj question

2012-12-04 Thread Steve Molloy
Thanks, for some reason I got stopped with the fact that XMLWriter wanted 
SolrQueryRequest/Response instead of the NamedList available in solrj's 
QueryResponse and never looked at building those from the info I already had. 
It is working now.

For the comment on efficiency, I do have to agree that parsing to Java object 
and then serializing back is less than optimal to say the least. The reason it 
has to be done in our case is because the component acting as proxy also 
supports extra parameters for some of our business logic that will modify the 
incoming query in some cases, decide where it goes in others, etc. So to avoid 
rewriting the logic inside of CloudSolrServer, I want to reuse it (I really 
hate duplicating code). But the output is a Java object (QueryResponse), so I 
have to serialize it back. Unless there's a way to get the original message 
before it's unmarshaled into the QueryResponse, in which case I'd be more than 
happy to use that as-is. :)

Anyways, as I mentioned, it seems to be working for now. And I do use javabin 
between that component and Solr no matter what was asked in the request since I 
can then marshal it to anything.

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo




http://www.opentext.com/2/email-signature-event

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 04, 2012 10:24 AM
To: dev@lucene.apache.org
Subject: Re: Solrj question

Believe there are no setParser method on CloudSolrServer?

Have you tried this:
XMLWriter.writeResponse(a java.io.Writer for your XML output, your 
SolrQueryRequest, your SolrQueryResponse)
It will require you to include solr-core, since that is where XMLWriter lives.

But it is a little inefficient, if I understand you correctly. If you have a 
CloudSolrServer doing a request and asks for a response in e.g. XML format, 
then this CloudSolrServer will receive a XML response over the wire, parse it 
into a SolrQueryResponse object and then you will take that SolrQueryResponse 
and serialize it back to XML. It would be nicer if you just used whatever was 
received on the wire directly.

Regards, Per Steffensen

Erick Erickson skrev:
haven't tried this personally, but try this:

server.setParser(new XMLResponseParser());





Best

Erick

On Mon, Dec 3, 2012 at 10:24 AM, Steve Molloy 
smol...@opentext.commailto:smol...@opentext.com wrote:
I've been digging around a bit and could not find any straight-forward way of 
getting back the XML response after calling Solr using Solrj. The query method 
returns a QueryResponse object, which is great in most cases. But our use case 
implies pushing the response back to whatever format was requested, but still 
use the CloudSolrServer client. This is very easy with the javabin format, 
using the JavaBinCodec, but is there equivalent utilities to marshal into other 
formats from a NamedList? Otherwise, could the functionality be isolated for 
better reuse?

Thanks,

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406tel:908-5406%20406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo

Nstein is now OpenText.
Please update your address book with my new email address.

This email message is confidential, may be privileged, and is intended for the 
exclusive use of the addressee. Any other person is strictly prohibited from 
disclosing or reproducing it. If the addressee cannot be reached or is unknown 
to you, please inform the sender by return email and delete this email message 
and all copies immediately.



inline: image001.gifinline: image002.gif

Re: Solrj question

2012-12-04 Thread Per Steffensen

Steve Molloy skrev:

I really hate duplicating code

I love you :-)
Unless there's a way to get the original message before it's 
unmarshaled into the QueryResponse, in which case I'd be more than 
happy to use that as-is. J
Ha ha. Just had a short look at the code, and tried to hack it, but got 
tired, so I didnt complete or test it. But maybe this will help you 
(completely untested - dont even know if it will compile):


   CloudSolrServer client = new 
CloudSolrServer(zk-connect-string, new LBHttpSolrServer(null) {

   @Override
   protected HttpSolrServer makeServer(String 
baseUrl) throws MalformedURLException {
   return new HttpSolrServer(baseUrl, 
getHttpClient(), null) {

   @Override
   public NamedListObject request(final 
SolrRequest request) throws SolrServerException, IOException{

   return request(request, null);
   }
   };
   }
   });
   InputStream responseDirectlyFromWire = 
(InputStream)client.query(query).getResponse().get(stream);




Re: Solrj question

2012-12-04 Thread Chris Hostetter

: Believe there are no setParser method on CloudSolrServer?

I'm not sure why CloudSolrServer doesn't let you specify the parser ... i 
would suggest filing a feature request to make that possible.

Even assuming you have that, Erick's suggestion isn't quite what you 
want...

:  haven't tried this personally, but try this:
:  server.setParser(new XMLResponseParser());

...because that tells the SolrServer instance to use the XMLResponseParser 
to parse the data into a QueryResponse.

What you want is essentially to write your own ResponesParser that doesn't 
do any parsing, and just returns a pointer to the the InputStream it's 
given.

Assuming you have that, it may not matter that CloudSolrServer doesn't let 
you specify a default RequestParser, you *should* be able to just call 
SolrRequest.setResponseParser() to force your specific parser to be used 
(but i haven't sanity checked that works with CloudSolrServer)


-Hoss

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Solrj question

2012-12-03 Thread Steve Molloy
I've been digging around a bit and could not find any straight-forward way of 
getting back the XML response after calling Solr using Solrj. The query method 
returns a QueryResponse object, which is great in most cases. But our use case 
implies pushing the response back to whatever format was requested, but still 
use the CloudSolrServer client. This is very easy with the javabin format, 
using the JavaBinCodec, but is there equivalent utilities to marshal into other 
formats from a NamedList? Otherwise, could the functionality be isolated for 
better reuse?

Thanks,

Steve Molloy
Content Analytics Lead  |  RD

Phone:

(514) 908-5406 406

Website:

www.opentext.comhttp://www.opentext.com/


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo

Nstein is now OpenText.
Please update your address book with my new email address.

This email message is confidential, may be privileged, and is intended for the 
exclusive use of the addressee. Any other person is strictly prohibited from 
disclosing or reproducing it. If the addressee cannot be reached or is unknown 
to you, please inform the sender by return email and delete this email message 
and all copies immediately.

inline: image001.gif

Re: Solrj question

2012-12-03 Thread Erick Erickson
haven't tried this personally, but try this:

server.setParser(new XMLResponseParser());


Best

Erick



On Mon, Dec 3, 2012 at 10:24 AM, Steve Molloy smol...@opentext.com wrote:

  I’ve been digging around a bit and could not find any straight-forward
 way of getting back the XML response after calling Solr using Solrj. The
 query method returns a QueryResponse object, which is great in most cases.
 But our use case implies pushing the response back to whatever format was
 requested, but still use the CloudSolrServer client. This is very easy with
 the javabin format, using the JavaBinCodec, but is there equivalent
 utilities to marshal into other formats from a NamedList? Otherwise, could
 the functionality be isolated for better reuse?

 ** **

 Thanks,

 ** **

 *Steve Molloy*
 Content Analytics Lead  |  RD

 Phone:

 (514) 908-5406 406

 Website:

 www.opentext.com

 [image: 
 http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]http://www.opentext.com/2/email-signature-logo

 Nstein is now OpenText.
 *Please update your address book with my new email address.*

 This email message is confidential, may be privileged, and is intended for
 the exclusive use of the addressee. Any other person is strictly prohibited
 from disclosing or reproducing it. If the addressee cannot be reached or is
 unknown to you, please inform the sender by return email and delete this
 email message and all copies immediately.

 ** **

image001.gif