lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radha C." <>
Subject RE: Query parameter encode issue
Date Tue, 16 Jun 2009 15:54:00 GMT
Thanks for your reply.. 
If that is the case, I need to do as follows, 
"+text:" + URLEncoder.encode("test", "UTF-8") +URLEncoder.encode(" ",
"UTF-8")+"+site_id"+URLEncoder.encode(xxxxxx, "UTF-8") 
Do I need to encode the space between two search field also? It is difficult
for me to do like this because I am having many search fields and forming
the query string dynamically. 
Is there any other way I can do this? or else I will follow this then.


From: Avlesh Singh [] 
Sent: Tuesday, June 16, 2009 8:38 PM
Subject: Re: Query parameter encode issue

qryString = "+text:test +site_id:(4 ) +publishDate:[2008-05-01T00\:00\:00Z
TO 2009-06-30T00\:00\:00Z]";
URLEncoder.encode(qryString, "UTF-8");

You don't have to encode the complete query string parameter. You just need
encode the values for individual query paramters.

So it should be more like qryString = "+text:" + URLEncoder.encode("test",
"UTF-8") ... and so on.


On Tue, Jun 16, 2009 at 8:20 PM, Radha C. <> wrote:

Hello list,

I am having the following query,
q=+text:test +site_id:(4 ) +publishDate:[2008-05-01T00\:00\:00Z TO

If I try this query in the browser directly , it is working fine and the url
is encoded automatically in the browser when I enter as follows


In my developed solr client, I am using the following code to encode,

qryString = "+text:test +site_id:(4 ) +publishDate:[2008-05-01T00\:00\:00Z
TO 2009-06-30T00\:00\:00Z]";
URLEncoder.encode(qryString, "UTF-8");

and the encoded url is like this,


I am just encoding the parameter value ( +text:test +site_id:(4 )
+publishDate:[2008-05-01T00\:00\:00Z TO 2009-06-30T00\:00\:00Z] ) and not
parameter name ( q=).

Can anyone please tell me what mistake I have done here?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message