[ 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.<init>(HttpMethodBase.java:222) at org.apache.commons.httpclient.methods.GetMethod.<init>(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.