>
> 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.

Cheers
Avlesh

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

> Hello list,
>
> I am having the following query,
> q=+text:test +site_id:(4 ) +publishDate:[2008-05-01T00\:00\:00Z TO
> 2009-06-30T00\:00\:00Z]
>
> 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
>
>
> http://localhost:8983/solr/TeamSite/select?q=+text:test%20+site_id:(4%20)%20
> +publishDate:[2008-05-01T00<http://localhost:8983/solr/TeamSite/select?q=+text:test%20+site_id:%284%20%29%20%0A+publishDate:%5B2008-05-01T00>
> \:00\:00Z%20TO%202009-06-30T00\:00\:00Z]
>
> 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,
>
>
> http://localhost:8983/solr/TeamSite/select?q=%2Btext%3Atest+%2Bsite_id%3A%28
>
> 4+%29+%2BpublishDate%3A%5B2008-05-01T00%5C%3A00%5C%3A00Z+TO+2009-06-30T00%5C
> %3A00%5C%3A00Z%5D<http://localhost:8983/solr/TeamSite/select?q=%2Btext%3Atest+%2Bsite_id%3A%28%0A4+%29+%2BpublishDate%3A%5B2008-05-01T00%5C%3A00%5C%3A00Z+TO+2009-06-30T00%5C%0A%3A00%5C%3A00Z%5D>
>
> 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?
>
>

Reply via email to