[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505313 ] Ryan McKinley commented on SOLR-20: --- solr 1.2 was released ~1 week ago so the next official stable release is at least a few months out. The solrj client is quite stable (I won't say that too strongly until more people are using it) and will be included in solr nightly builds. While I don't recommend using the solr server nightly builds, the client should be ok. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Assignee: Ryan McKinley >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505304 ] Michael Young commented on SOLR-20: --- We are planning to replace our custom Lucene implementation with Solr in the next release of Liferay. This Java client would be extremely useful to us and we would like to see it in the next stable release. When do you anticipate this, or at least an alpha version? > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Assignee: Ryan McKinley >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504912 ] Ryan McKinley commented on SOLR-20: --- I'm integrating SOLR-20 with trunk now... The basic stuff is no problem. I'm struggling with the best way to: * included shared libraries (commons-io, etc) * structure build.xml * add tests that launch jetty * package solrj (and dependencies) I think the best approach is to commit my best effort and then have you all review/fix/modify. Building a useful patch is unrealistic. ryan > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Assignee: Ryan McKinley >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
Thanks. He was right. I've noticed that the HTTPClient has no connection timeout (http://jakarta.apache.org/commons/httpclient/preference-api.html#HTTP_connection_parameters) setted, maybe there is a way to set it out-of-the-client (any suggestion?), but it would help this connection timeout to be settable somehow on a BaseSolrServer object. The only change to CommonsHttpSolrServer would be this set function, and a client.setConnectionTimeout(settedvalue); after the HttpClient initing in request method. It may be useful? There are any other way to play with http timeout parameters (at least connectionTimeout), without changing code inside the client code? Problem arise when the server is down (jetty/tomcat/etc, or the machine itself), and server.query takes a minute before throwing exception. -- Walter Ryan McKinley (JIRA) wrote: > [ > https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502885 > ] > > Ryan McKinley commented on SOLR-20: > --- > > I don't know if you are on solr-dev, Yonik noted that the QTime does not > include the time to write the response, only the query time. To get an > accurate number for how long the whole query takes, check your app server logs > http://www.nabble.com/Re%3A-A-simple-Java-client-for-updating-and-searching-tf3890950.html > > To get a quick response from solr, try rows=0 or a 404 path. (Of course, the > speed will depend on you network connection speed between client-server) > > >> A simple Java client for updating and searching >> --- >> >> Key: SOLR-20 >> URL: https://issues.apache.org/jira/browse/SOLR-20 >> Project: Solr >> Issue Type: New Feature >> Components: clients - java >> Environment: all >>Reporter: Darren Erik Vengroff >>Priority: Minor >> Attachments: DocumentManagerClient.java, DocumentManagerClient.java, >> solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, >> solr-client.zip, solr-client.zip, solr-client.zip, >> solrclient_addqueryfacet.zip, SolrClientException.java, >> SolrServerException.java >> >> >> I wrote a simple little client class that can connect to a Solr server and >> issue add, delete, commit and optimize commands using Java methods. I'm >> posting here for review and comments as suggested by Yonik. >> > >
RE: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
: Has anyone thought of adding the docsum time to the qtime or possibly : adding separate timing information for the real 'solr query time'. it's pretty much impossible to include in the response a value which indicates the total amount of time needed to generate the response... 1) the response is getting stream to the client as the ResponseWRiter generates it ... so a number like that could be "unfairly" high if the network is slow. 2) if the number is part of the response, and Solr needs to compute the number based on how long the entire response took to generate/send, then there is a catch22 ... at best a response writer could include a time value as the *very* last thing it sends, and report the time up to that point, but that wouldn't be the *total* time (and wouldn't include how long it took to close the connection on the server side) ...this is why log files are usually the best way to get timing info ... you can log the *real* total time when you are all done. -Hoss
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 8-Jun-07, at 10:57 AM, Will Johnson wrote: Has anyone thought of adding the docsum time to the qtime or possibly adding separate timing information for the real 'solr query time'. While my bosses are very pleased that most searches seem to take ~5ms it does seem a bit misleading. docsum? Summarizing? That is already part of QTime. However, loading document stored fields isn't. Interestingly, you can force it to be part of QTime as a side-effect of specifying useLazyFieldLoading=true in solrconfig.xml. Also, there is a patch here which already provide detailed timing data: http://issues.apache.org/jira/browse/SOLR-176 I'll take a crack at a patch unless there is a reason not to. -Mike
RE: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
Has anyone thought of adding the docsum time to the qtime or possibly adding separate timing information for the real 'solr query time'. While my bosses are very pleased that most searches seem to take ~5ms it does seem a bit misleading. I'll take a crack at a patch unless there is a reason not to. - will -Original Message- From: Ryan McKinley (JIRA) [mailto:[EMAIL PROTECTED] Sent: Friday, June 08, 2007 1:09 PM To: solr-dev@lucene.apache.org Subject: [jira] Commented: (SOLR-20) A simple Java client for updating and searching [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.pl ugin.system.issuetabpanels:comment-tabpanel#action_12502885 ] Ryan McKinley commented on SOLR-20: --- I don't know if you are on solr-dev, Yonik noted that the QTime does not include the time to write the response, only the query time. To get an accurate number for how long the whole query takes, check your app server logs http://www.nabble.com/Re%3A-A-simple-Java-client-for-updating-and-search ing-tf3890950.html To get a quick response from solr, try rows=0 or a 404 path. (Of course, the speed will depend on you network connection speed between client-server) > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods. I'm posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502885 ] Ryan McKinley commented on SOLR-20: --- I don't know if you are on solr-dev, Yonik noted that the QTime does not include the time to write the response, only the query time. To get an accurate number for how long the whole query takes, check your app server logs http://www.nabble.com/Re%3A-A-simple-Java-client-for-updating-and-searching-tf3890950.html To get a quick response from solr, try rows=0 or a 404 path. (Of course, the speed will depend on you network connection speed between client-server) > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502872 ] Walter Ferrara commented on SOLR-20: Latest rev works perfectly thanks. I've been making some time test with this client (only searching), and overall results show high times: this maybe due to my minimal knowledge on solr, but solr seems fast, is data-receiving/parsing on client that seems slow. Even when solr report 0ms (due to cache it I presume) it still take 200ms to get results (QueryResponse .getElapsedTime()). I'm using this code: SolrQuery query = new SolrQuery(queryString); CommonsHttpSolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solr/";); QueryResponse response = server.query(query); SolrDocumentList list = response.getResults(); The slowdown seems to be in client.executeMethod(method) (CommonsHttpSolrServer) Any way to speed up (assuming I'm not totally wrong on how to use this client...)? Reusing same http connection for multiple queries? Playing with MultiThreadedHttpConnectionManager helped a bit, but doesn't seems the solution > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502852 ] Yonik Seeley commented on SOLR-20: -- FYI partialURLEncodeVal was meant for readable, yet unambiguous logging... hence a minimum of escaping is done (but enough to easily paste into a browser and let it do the rest of the escaping when you sumbit). > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502490 ] Walter Ferrara commented on SOLR-20: yeah, i eventually modified the function to be just public static void partialURLEncodeVal(Appendable dest, String val) throws IOException { dest.append(java.net.URLEncoder.encode(val, "UTF-8")); } so exactly the same thing, this way works good on non-english language too. -- Walter > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502489 ] Ryan McKinley commented on SOLR-20: --- Hi Walter- I just updated http://solrstuff.org/svn/solrj/ to use: URLEncoder.encode( val, "UTF-8" ) rather then: StrUtils.partialURLEncodeVal( val ) Give it a try and let me know if you have problems... (i have done date range queries successfully with resin/jetty, but netbeans must be different!) > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502470 ] Walter Ferrara commented on SOLR-20: [I'm new to solrj, so everything I'm write can be useless] While trying to execute range query, using this query: Text:Hello +Date:[1895011 TO 18971128] [jdk 1.6/netbeans 5.5/solr1.2/solrj revision 125] I kept getting IllegalArgumentException: [...] Caused by: java.lang.IllegalArgumentException: Invalid uri 'http://localhost:8983/solr/select?q=Text:Hello+%2BDate:[1895011+TO+18971128]&fl=ID,Date,score&rows=800&wt=xml&version=2.2': Invalid query at org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:222) at org.apache.commons.httpclient.methods.GetMethod.(GetMethod.java:89) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:108) [...] It seems related to un-escaped '[' and ']'. the solution was to patch StrUtils.java, in order to encode square brackets. If it is of any use, I'm attaching the patch -- Walter StrUtils.java.patch 204,207d203 < case '[': dest.append("%5B"); break; // to allow range query, 20070706 (w) < case ']': dest.append("%5D"); break; < case '{': dest.append("%7B"); break; < case '}': dest.append("%7D"); break; > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499831 ] Ryan McKinley commented on SOLR-20: --- Hi Ben- Thanks for the patch. Will Johnson added the options to the java client on: http://solrstuff.org/svn/solrj/ This implementation is now quite stable (thanks to lots of help from Will!) and I hope will be integrated into solr trunk shortly after 1.2 (this week?!) About the allowDups/overwritePending/overwriteCommited options... what part of them do you use? In SOLR-60, there is talk of replacing the three options with a (simpler) overwrite=true/false -- maybe we should change the client api to: UpdateResponse add( SolrDocument doc, boolean overwrite ) throws SolrServerException; In anticipation of this change? > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499730 ] Ben Incani commented on SOLR-20: The SolrClientImpl does not implement the following optional attributes for "add" as documented in http://wiki.apache.org/solr/UpdateXmlMessages allowDups = "true" | "false" — default is "false" overwritePending = "true" | "false" — default is negation of allowDups overwriteCommitted = "true"|"false" — default is negation of allowDups Attached is patch for SolrClientImpl.java which implements allowDups. *** SolrClientImpl.java.patch *** 48a49,55 > > /** >* Optional attributes for "add" >*/ > protected boolean allowDups; > protected boolean overwritePending;// TODO: not implemented > protected boolean overwriteCommitted; // TODO: not implemented 86a94,97 > public SolrClientImpl(URL baseURL) throws Exception { > this(baseURL, false); > } > 91a103 >* @param allowDups allow duplicates to be added to the index 95c107 < public SolrClientImpl(URL baseURL) throws Exception --- > public SolrClientImpl(URL baseURL, boolean allowDups) throws Exception 103c115 < --- > this.allowDups = allowDups; 243c255,260 < writer.write(""); --- > StringBuffer strAdd = new StringBuffer(" if (allowDups == true) { >strAdd.append("allowDups=\"true\""); > } > strAdd.append(">"); > writer.write(strAdd.toString()); *** SolrClientImpl.java.patch *** > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493006 ] Ryan McKinley commented on SOLR-20: --- great! Any feedback/help would be wonderful. I hope it is not *too* long before this can enter solr trunk, but it will first need two solr1.3 additions SOLR-193 and SOLR-135, until then I can apply any patches necessary. Re RuntimeException vs SolrServerException, I'm not sure the best choice. Earlier versions had a client exception and server exception, but in practice those got lumped together (in my case) anyway. I ended up just using SolrException because it is there. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492902 ] Will Johnson commented on SOLR-20: -- the new api's work great, thanks! what's the plan for this going forward? id' like to start doing some work on this as it's rather critical to my current project and an are i've dealt with a lot in the past. assuming it's not getting dumped into org.apache.* land any time soon are you accepting patches to this code? if so i have some modifications to the api's that i think will make them easier to use (such as a method to set FacetParams on SolrQuery) and i'll even flush out the SolrServerTest for fun. also, i noticed that all the methods on SolrServer throw undeclared SolrExceptions which extends RuntimeException when things so south. should those throw some other sort of non-ignorable exception like a new SolrServerException? while it made coding/compiling easier to leave out all the usually required try's and catches it made running/debugging much less enjoyable. - will > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492716 ] Ryan McKinley commented on SOLR-20: --- aaah, It was compiling with java 6. I just added stax-api-1.0.jar and cleaned up some imports, it should run on java 5 now. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492700 ] Will Johnson commented on SOLR-20: -- the trunk version at http://solrstuff.org/svn/solrj/ seems to be missing a dependency and a copy of SolrParams. ant returns compile: [javac] Compiling 40 source files to C:\data\workspace\solrj\bin [javac] C:\data\workspace\solrj\src\org\apache\solr\client\solrj\impl\XMLResponseParser.java:10: package javax.xml.stream does not exist [javac] import javax.xml.stream.XMLInputFactory; [javac] C:\data\workspace\solrj\src\org\apache\solr\client\solrj\query\SolrQuery.java:10: cannot find symbol [javac] symbol : class SolrParams [javac] location: package org.apache.solr.util [javac] import org.apache.solr.util.SolrParams; > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492608 ] Ryan McKinley commented on SOLR-20: --- For anyone interested, I've finished a major overhaul of the client at: http://solrstuff.org/svn/solrj/ It is a dramatically different architecture then before. Essentially it reads each response into a NamedList and each response type knows what the contents mean. After solr1.2, I'll work on getting something like this into the official apache distribution. This client source duplicates many classes that will eventually be extracted into an independent solr-utils.jar (SOLR-135). Everything that is not in "client" http://solrstuff.org/svn/solrj/src/org/apache/solr/ will be in this .jar I am using this in production code -- but i don't suggest that it is production ready just yet. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490121 ] Ryan McKinley commented on SOLR-20: --- For now, I'd still recommend using solr-client.zip The code on solrstuff.org is in the middle of a big overhaul (hopefully stable by the end of this week) -- but it will rely on some changes to solr that are not likely to make it into solr-1.2. I'll post another message here when that settles down. thanks ryan > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490117 ] Will Johnson commented on SOLR-20: -- is there an updated package or anyone working on such a thing at the moment? the solr-client.zip at the top of the thread works like a charm but seems to be very outdated and the bits on the svn://solrstuff.org site have some rather serious bugs. i'm happy to do all the leg work of packaging things, fixing bugs, submitting a patch, etc but i wanted to make sure i'm not about to walk right behind someone else. also, if anyone has any ideas for the best starting point i'm happy to take suggestions. - will > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488702 ] carlos orrego commented on SOLR-20: --- I am using the client library nad have no issues with adding docs to solr. But when i want to make a simple test query i keep getting this error: org.apache.solr.client.exception.SolrClientException: unknown type: status Solr returns and xml with a statis tag in the header wich the client does not know how to handle? am i right? is this the case? > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, > solrclient_addqueryfacet.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 3/22/07, Thierry Collogne (JIRA) <[EMAIL PROTECTED]> wrote: I think that is all. If I forgot something, post it here. One remark. The setHighlightSurroundingTags method can only take simple tags, no tags containing quotes or such. Out of curiosity, why is this? Solr should be able to handle it. -Mike
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483051 ] Thierry Collogne commented on SOLR-20: -- I found that there was no way of adding highlight paramters to an SolrQuery, so I made some modifications to SolrQuery.java and ParamNames.java to allow highlighting Changes to SolrQuery First add a new variable private HighlightParams _highlight = new HighlightParams(); Than I defined a new innerclass (a bit like FacetParams) public static class HighlightParams { public List field = new ArrayList(); public int snippets = 3; public int fragsize = 100; public String simple_pre = ""; public String simple_post = ""; public boolean isEnabled() { return field.size() > 0; } } Than add the following methods public void addHighlightField( String f ) { _highlight.field.add( f ); } public void setHighlightSnippets( int snippets ) { _highlight.snippets = snippets; } public void setHighlightFragSize( int fragsize ) { _highlight.fragsize = fragsize; } // ATTENTION : only simple tags. No quotes like in public void setHighlightSurroundingTags( String pre, String post ) { _highlight.simple_pre = pre; _highlight.simple_post = post; } Add the following code to getQueryString method (for example right before return builder.toString();) if( _highlight.isEnabled() ) { builder.append( '&' ).append( ParamNames.HIGHLIGHT ).append( "=true" ); builder.append( '&' ).append( ParamNames.HIGHLIGHT_FIELDS ).append( "=" ); for( String f : _highlight.field ) { builder.append( f ).append( ',' ); } builder.append( '&' ).append( ParamNames.HIGHLIGHT_SNIPPETS ).append( "=" ).append( _highlight.snippets ); builder.append( '&' ).append( ParamNames.HIGHLIGHT_FRAGSIZE ).append( "=" ).append( _highlight.fragsize ); builder.append( '&' ).append( ParamNames.HIGHLIGHT_SIMPLE_PRE ).append( "=" ).append( _highlight.simple_pre ); builder.append( '&' ).append( ParamNames.HIGHLIGHT_SIMPLE_POST ).append( "=" ).append( _highlight.simple_post ); } Changes to ParamNames.java Add/modify the following variables /** wether to highlight */ public static final String HIGHLIGHT = "hl"; /** fields to highlight */ public static final String HIGHLIGHT_FIELDS = "hl.fl"; /** maximum highlight fragments to return */ public static final String HIGHLIGHT_SNIPPETS = "hl.snippets"; /** override default highlight fragsize */ public static final String HIGHLIGHT_FRAGSIZE = "hl.fragsize"; /** override default pre highlight */ public static final String HIGHLIGHT_SIMPLE_PRE = "hl.simple.pre"; /** override default post highlight */ public static final String HIGHLIGHT_SIMPLE_POST = "hl.simple.post"; This can be used as follwed SolrClient client = new SolrClientImpl( new URL("http://localhost:8080/solr/";) ); // required query.addHighlightField("title"); query.addHighlightField("content"); // following is optional query.setHighlightFragSize(100); query.setHighlightSnippets(3); query.setHighlightSurroundingTags("",""); I think that is all. If I forgot something, post it here. One remark. The setHighlightSurroundingTags method can only take simple tags, no tags containing quotes or such. Greetz. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478810 ] Frederic Hennequin commented on SOLR-20: Hello, we have been testing the solr-client and think we have found a small bug : the xml parsers on the query-side is not setup to use "UTF-8" encoding this resulted in weird characters being returned by the solr-client... for example : "é" came out like "©" ... not really what we would like... we fixed it by setting the input stream for the xmlparser to "UTF8" which gave us this code in ResultsParser.java : [code] public QueryResults process( InputStream reader ) throws SolrClientException, SolrServerException, XmlPullParserException, IOException { QueryResults res = new QueryResults(); try { XmlPullParser xpp = null; try { xpp = factory.newPullParser(); xpp.setInput(reader,"UTF-8"); xpp.nextTag(); } . [/code] notice we changed the argument for this method to InputStream instead of the reader so we could add "UTF-8" to the stream. by doing this we had to change the reader in SolrClientImpl.java to an inputstream : [code] InputStream inputStream = urlc.getInputStream(); try { QueryResults res = parser.process( inputStream ); res.setSolrURL( qurl ); res.setQuery( query ); return res; } [/code] in our opinion this was a major bug (since all solr-xml is encoded in utf-8) and we guess somebody just forgot to put it in... yay, now we can all start using freaky characters without the client actually freaking out :) enjoy > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474078 ] Ryan McKinley commented on SOLR-20: --- I don't think this one is quite ready to go, but anyone interested can see an updated versions at: http://solrstuff.org/svn/solrj/ http://solrstuff.org/svn/solrj-hibernate/ I have extracted the hibernate specific stuff into its own project so solrj is a bit more manageable. - - - - - If you are looking for a stable, simple client "solr-client.zip" is still your best bet. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474032 ] Erik Hatcher commented on SOLR-20: -- My bad... it was SOLR-86 that interested me, and I've just committed it.I can't take on these patches just yet. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474012 ] Erik Hatcher commented on SOLR-20: -- I want this on trunk also. I'll be reviewing it and testing it out this afternoon and committing if all is fine. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473993 ] rubdabadub commented on SOLR-20: Hi: I was really hoping that this patch will make it to trunk soon. I been using it without any problem. I was wondering if there are any specifics that are left for SOLR-20 to make it to trunk? I would be more then happy to help out anyway I can. I need SOLR-20 for Nutch-Solr integration so it would be nice if it was included. Thankful for your kind attention to SOLR-20. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 1/25/07, Chris Hostetter <[EMAIL PROTECTED]> wrote: : IMO, we should strive to be nice and not repeat keys when the : NamedList is more of the Map variety than the List. we should try .. but we can't garuntee .. i don't have any compelling cases where i've needed to reuse the same name, but i've certainly written plenty of code that puts multiple items in a list that have no name. : > mechanism from the client code like this one -- using XML really is the : > safest bet since it's the most expressive of all the formats we currently : > have) : : JSON responses are smaller and can be quite a bit faster to parse. i won't argue it's not faster or smaller -- just that it's not as expressive :) True, but for most specific client applications, it doesn't matter because the extra info is redundant. The extra info can be nice for generic applications... (knowing what field is a date field, for example). Erik is solving that in Flare via naming convention I think... -Yonik
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
: IMO, we should strive to be nice and not repeat keys when the : NamedList is more of the Map variety than the List. we should try .. but we can't garuntee .. i don't have any compelling cases where i've needed to reuse the same name, but i've certainly written plenty of code that puts multiple items in a list that have no name. : > mechanism from the client code like this one -- using XML really is the : > safest bet since it's the most expressive of all the formats we currently : > have) : : JSON responses are smaller and can be quite a bit faster to parse. i won't argue it's not faster or smaller -- just that it's not as expressive :) i'm guessing that if you generated enough JSON markup to be equally expressive and safe, the size would go up considerably (but still probably not be as big as XML) and the speed would be affected to some degree as well -- not to mention the ease of use, accessing the new more complex JSON structures you would have. -Hoss
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 1/25/07, Chris Hostetter <[EMAIL PROTECTED]> wrote: : I'm using a slightly modified version of the json.org code. It stores : things in a LinkedHashMap (to maintain order) and formats dates : explicitly. Uh... watch out with that ... a LinkedHashMap is first and for most a Map, so it doesn't support repeated keys. I currently have some (ugly) code in the response writer that handles repeated keys, just not nicely. IMO, we should strive to be nice and not repeat keys when the NamedList is more of the Map variety than the List. (I suspect for a client API that's going to completley hide the transport mechanism from the client code like this one -- using XML really is the safest bet since it's the most expressive of all the formats we currently have) JSON responses are smaller and can be quite a bit faster to parse. -Yonik
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
: > > * I'm using wt=JSON rather then XML. (It maps to a hash easier) : I'm using a slightly modified version of the json.org code. It stores : things in a LinkedHashMap (to maintain order) and formats dates : explicitly. Uh... watch out with that ... a LinkedHashMap is first and for most a Map, so it doesn't support repeated keys. (I suspect for a client API that's going to completley hide the transport mechanism from the client code like this one -- using XML really is the safest bet since it's the most expressive of all the formats we currently have) -Hoss
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 1/25/07, Ryan McKinley <[EMAIL PROTECTED]> wrote: > > On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote: > > new SolrPing().process( server ); > > doesn't > >server.ping(); > > look cleaner? > I can't argue with you there! I may be taking Hoss's point #4 on https://issues.apache.org/jira/browse/SOLR-20#action_12464641 too seriously. My revised version is designed totally around Requests processing a handler's response. The server does not even know what handlers it may be running - it is just the transport layer between the request and the response. But that may be too big of an abstraction for the simple use case. server.ping() server.add( documents ); server.delete( id ); server.select( options ); ... are obviously cleaner. One form doesn't preclude the other either you can have both. For more complex or custom request handlers, keeping the logic (and library dependencies) out of the server seems like a good idea. -Yonik
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote: > new SolrPing().process( server ); doesn't server.ping(); look cleaner? I can't argue with you there! I may be taking Hoss's point #4 on https://issues.apache.org/jira/browse/SOLR-20#action_12464641 too seriously. My revised version is designed totally around Requests processing a handler's response. The server does not even know what handlers it may be running - it is just the transport layer between the request and the response. But that may be too big of an abstraction for the simple use case. server.ping() server.add( documents ); server.delete( id ); server.select( options ); ... are obviously cleaner. ryan
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote: new SolrPing().process( server ); doesn't server.ping(); look cleaner? //Ed
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
This might seem outlandish but have you considered modeling a server instead of a client? Then you can send request messages to it and get back response messages. SolrSelectResponse response = server.select(selectOptions); I like the model, but the I want to be able easily write a client for a custom SolrRequestHandler. The server model can't be tied directly to update(), select(), ping() etc right now I'm working with: public interface SolrServer { SolrResponse request( final String path, final METHOD method, final RequestParams params, final Collection streams, final ResponseStreamProcessor processor ) ; } public interface ResponseStreamProcessor { SolrResponse processResponseStream( InputStream body ); } public interface SolrRequest { SolrResponse process( SolrServer server ) ; } - - - - - - - - - - This would be a sample 'ping' request: public class SolrPing implements SolrRequest { public SolrResponse process(SolrServer server) { return (SolrPingResponse)server.request( "/admin/ping", METHOD.GET, null, null, new ResponseStreamProcessor() { public SolrResponse processResponseStream(InputStream body) { // something real would actually process the body return new SolrPingResponse(); } }); } } And you can call it with: new SolrPing().process( server );
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On Jan 24, 2007, at 4:05 PM, Ken Krugler wrote: SolrQueryResponse rsp = (SolrQueryResponse)client.process( req ); vs SolrQueryResponse rsp = queryRequest.execute( client ); This might seem outlandish but have you considered modeling a server instead of a client? Then you can send request messages to it and get back response messages. SolrSelectResponse response = server.select(selectOptions); //Ed
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
On 1/24/07, Ken Krugler <[EMAIL PROTECTED]> wrote: Hi Ryan, >The big API question/style i'm struggling with is > >SolrResponse rsp = client.process( req ); > vs >SolrResponse rsp = req.execute( client ); // execute may not be the >right word > >The first one is more natural, and is how things are actually >processed. The second one allows eliminates the need for lots of >casting: > >SolrQueryResponse rsp = (SolrQueryResponse)client.process( req ); >vs >SolrQueryResponse rsp = queryRequest.execute( client ); > >Any thoughts? Haven't dug into the client code, but my natural inclination would be to go with the latter...it fits better with how I'd write the test code if I was implementing such a thing. E.g. create a mock client and then use that to test the request object. I think I agree with the latter, although I probably would have coded the former just because it would have occured to me first. The latter allows an easy way to create new request classes w/o having to couple tightly to the client. A type of request could make two calls two calls to the server, and join the responses or process them in different ways. I like it! -Yonik
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
Hi Ryan, The big API question/style i'm struggling with is SolrResponse rsp = client.process( req ); vs SolrResponse rsp = req.execute( client ); // execute may not be the right word The first one is more natural, and is how things are actually processed. The second one allows eliminates the need for lots of casting: SolrQueryResponse rsp = (SolrQueryResponse)client.process( req ); vs SolrQueryResponse rsp = queryRequest.execute( client ); Any thoughts? Haven't dug into the client code, but my natural inclination would be to go with the latter...it fits better with how I'd write the test code if I was implementing such a thing. E.g. create a mock client and then use that to test the request object. -- Ken -- Ken Krugler Krugle, Inc. +1 530-210-6378 "Find Code, Find Answers"
Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching
> * I'm using wt=JSON rather then XML. (It maps to a hash easier) Heh... I quickly checked out the code, but didn't see where you were parsing the code, or where the JSONObject class referenced is. Anyway, if you want the *best* JSON parser on the planet, check out http://www.nabble.com/Apache-Lab-proposal%3A-noggit-tf2701405.html#a7532843 http://svn.apache.org/repos/asf/labs/noggit/ :-) I haven't had a chance to do the writing side, or the "create full object graph" part, but the parser is screaming fast. I'm using a slightly modified version of the json.org code. It stores things in a LinkedHashMap (to maintain order) and formats dates explicitly. http://svn.lapnap.net/solr/solrj/src/org/apache/solr/util/json/ I just had a quick look at noggit. It looks interesting. If I understand it correctly, noggit is to XPP as the json.org code is to DOM > * handles multiple ContentStreams using multi-part form upload Will a client need to do that? I had thought a browser would be the only one using multi-part I don't know if it will *need* to do it - but I think the client API should be as close to the RequestHandler API as possible. Since (in SOLR-104) the server side accepts Iterable, the client should send Iterable. With commons http-client, sending multi-part data is almost equivolent to sending form data. > * You can define and automatically build a solr document with annotations Sounds cool > * Includes a first draft for a HibernateEventListener. Sounds *very* cool... it should go in a separate contrib eventually. Yes, it is a single class - quite small really - but has 8MB of required .jar files to compile and test it! When it is more stable and i have some time, i'll seperate it into two projects. - - - - - The big API question/style i'm struggling with is SolrResponse rsp = client.process( req ); vs SolrResponse rsp = req.execute( client ); // execute may not be the right word The first one is more natural, and is how things are actually processed. The second one allows eliminates the need for lots of casting: SolrQueryResponse rsp = (SolrQueryResponse)client.process( req ); vs SolrQueryResponse rsp = queryRequest.execute( client ); Any thoughts?
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467116 ] Yonik Seeley commented on SOLR-20: -- > * it is based on commons-httpclient-3.0.1.jar Cool, +1 > * I'm using wt=JSON rather then XML. (It maps to a hash easier) Heh... I quickly checked out the code, but didn't see where you were parsing the code, or where the JSONObject class referenced is. Anyway, if you want the *best* JSON parser on the planet, check out http://www.nabble.com/Apache-Lab-proposal%3A-noggit-tf2701405.html#a7532843 http://svn.apache.org/repos/asf/labs/noggit/ :-) I haven't had a chance to do the writing side, or the "create full object graph" part, but the parser is screaming fast. > * handles multiple ContentStreams using multi-part form upload Will a client need to do that? I had thought a browser would be the only one using multi-part > * You can define and automatically build a solr document with annotations Sounds cool > * Includes a first draft for a HibernateEventListener. Sounds *very* cool... it should go in a separate contrib eventually. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466970 ] Ryan McKinley commented on SOLR-20: --- I have dramatically reworked the client code to fit with the pluggable ContentStream model in SOLR-104. This version makes it easy to customize/extend the request/response behavior. Once it stabilizes and is better tested, I'll upload a zip, but for now, you can preview it: http://svn.lapnap.net/solr/solrj/ Major changes: * it is based on commons-httpclient-3.0.1.jar * I'm using wt=JSON rather then XML. (It maps to a hash easier) * I moved some of the common classes to o.a.s.util. Hopefully the core classes will be refactored to make it easier to share some classes * handles multiple ContentStreams using multi-part form upload * Got rid of the SolrDocumentable/SolrDocumented distinction. -- now there is only SolrDocument() * You can define and automatically build a solr document with annotations * Includes a first draft for a HibernateEventListener. When stuff is added/updated/deleted, it gets sent to solr. (Note, this class should probable not be in the main client as the hibernate prerequisite libraries are substantial - I've included them because its what i need to have working soon) When this is more stable, it will be something similar to a Compass Hibernate3GpsDevice (http://www.opensymphony.com/compass/versions/1.1RC1/html/gps-hibernate.html) The key interfaces are: public interface SolrClient { public abstract SolrResponse process( final SolrRequest req ); } public interface SolrRequest { public String getMethod(); public String getHandlerPath(); public RequestParams getParams(); public Collection getContentStreams(); public SolrResponse parseResponseBody(InputStream in); public SolrResponse execute(SolrClient solr); } - - - - - - - Here is some sample usage: SolrClient client = new CommonsHttpSolrClient( new URL("http://localhost:8983/solr/";) ); // Set up a simple query SolrQuery query = new SolrQuery(); query.setQuery( "solr" ); query.addFacetField( "cat" ); query.setFacetLimit( 15 ); query.setQuery( "video" ); query.setShowDebugInfo( true ); QueryResponse rsp = query.execute( client ); for( ResultDoc doc : rsp.getDocs() ) { System.out.println( doc.get( "name" ) ); System.out.println( doc.getScore() ); System.out.println( doc.getExplain() ); } SimpleSolrDoc doc = new SimpleSolrDoc(); doc.setField( "id", "xxx" ); doc.setField( "price", 12.34f ); doc.setField( "cat", new String[] { "aaa", "bbb", "ccc" } ); new AddDocuments( doc ).execute( client ); new CommitIndex().execute( client ); - - - - - - - - - - - This also includes a utility to make solr documents from annotations. Given the class: @SolrSearchable( boost=2.0 ) public class Example { @SolrSearchable public String getName() { return "hello" } @SolrSearchable( name="cat", boost=3 ) public String getSomeOtherName() { return "there" } } The DocumentBuilder can automatically make: hello there - - - - - - - - - - - There are a few parts of the API i think are awkward, I'd love any feedback / review you may have. thanks ryan > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-20) A simple Java client for updating and searching
[ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464648 ] J.J. Larrea commented on SOLR-20: - Regarding Hoss' point #3, perhaps it's time to reorganize into something like /solr/server/... /solr/client/... /solr/webapp/,,, (or /solr/server/webapp) /solr/shared/... "To build client XXX check out /solr/client or just /solr/client/java/XXX and /solr/shared" Shared would include external constants and exceptions. > A simple Java client for updating and searching > --- > > Key: SOLR-20 > URL: https://issues.apache.org/jira/browse/SOLR-20 > Project: Solr > Issue Type: New Feature > Components: clients - java > Environment: all >Reporter: Darren Erik Vengroff >Priority: Minor > Attachments: DocumentManagerClient.java, DocumentManagerClient.java, > solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, > solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, > SolrServerException.java > > > I wrote a simple little client class that can connect to a Solr server and > issue add, delete, commit and optimize commands using Java methods. I'm > posting here for review and comments as suggested by Yonik. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira