You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Aaron Couch <aa...@zivtech.com> on 2012/03/20 02:23:00 UTC

url-encoded strings from Admin Query String search

Sorry if this is documented somewhere but I did searched a lot and couldn't
find the answer to this.

I'd like to be able to type in test queries and the /admin page but when I
do the url string created is url-encoded so that the resulting string
doesn't work.


If I type:

TEST&qf=t_FIELD_NAME

into the 'Query String' field the result is:

/select/?q=TEST%26qf%3Dt_FIELD_NAME&version=2.2&start=0&rows=10&indent=on
(provides no results)

instead of:

select/?q=TEST&qf=t_FIELD_NAME&version=2.2&start=0&rows=10&indent=on (which
provides results).

Am I missing something?


I'm using Solr Specification Version: 1.4.0.2009.10.20.08.05.56, on Ubuntu
10.04 running Tomcat6.

Any help is appreciated.

thanks,

-Aaron

Re: url-encoded strings from Admin Query String search

Posted by fbrisbart <fb...@bestofmedia.com>.
Maybe you don't use special characters such as '?', '&', ... in your
query, but other guys do.

If someone want to search for '? & the mysterians', it's impossible if
you don't encode it.
As the 'admin' interface must be used by anyone, the query has to be
url-encoded.


Franck

Le mercredi 21 mars 2012 à 18:41 -0500, Aaron Couch a écrit :
> Thanks again for the follow-up.
> 
> You are correct that '%3A' and ':' are equivalent. However if I type
> anything else, for example if I want to change the query parser to Lucene,
> the responseHeader returns an empty set.
> 
> If I type in the /admin screen:
> 
> t_FIELD_NAME:TEST&defType=lucene
> 
> I get:
> 
> select/?q=t_title%3Aweb%26defType%3Dlucene
> 
> The '&' and '%26' are not equivalent as well as the '=' and '%3D'.
> 
> I know I could easily just type the queries correctly in the URL, but I'm
> giving a training where I'd like to show how the queries generated in our
> application can be tested and it would be great to be able to use the
> /admin screen or have a good reason why we can't.
> 
> Thanks again,
> 
> -Aaron
> 
> On Wed, Mar 21, 2012 at 1:52 PM, fbrisbart <fb...@bestofmedia.com>wrote:
> 
> > I'm not sure to understand your problem.
> > The 2 urls :
> > .../select/?q=t_FIELD_NAME%3ATEST
> > and .../select/?q=t_FIELD_NAME:TEST
> >
> > are strictly the same.
> >
> > Look in the 'responseHeader', you'll see that query received is
> > t_FIELD_NAME:TEST for both urls.
> >
> >
> > Franck
> >
> >
> > Le mercredi 21 mars 2012 à 12:36 -0500, Aaron Couch a écrit :
> > > hi Franck;
> > >
> > > Thank you for your response. I'm not sure you understand my issue
> > however.
> > > I have dismax on by default so am able to use query fields.
> > >
> > > My problem is not in the queries themselves, but when they are input from
> > > the '/admin' screen they are url-encoded.
> > >
> > > If I take your suggestion and type in t_FIELD_NAME:TEST the ''/admin
> > screen
> > > I get redirected to the following:
> > >
> > > select/?q=t_FIELD_NAME%3ATEST
> > >
> > > instead of:
> > >
> > > select/?q=t_FIELD_NAME:TEST
> > >
> > > Is there a setting I should be aware of to stop the /admin screen from
> > > url-encoding strings? Or is there a setting to allow solr to accept
> > > url-encoded strings? Is this issue fixed in later versions after 1.4?
> > >
> > > Thanks,
> > >
> > > -Aaron
> > >
> > >
> > > On Wed, Mar 21, 2012 at 11:26 AM, fbrisbart <fbrisbart@bestofmedia.com
> > >wrote:
> > >
> > > > Hi,
> > > >
> > > > for your example query 'TEST&qf=t_FIELD_NAME ',
> > > > you can simply query :
> > > > t_FIELD_NAME:TEST
> > > >
> > > > If you really want to use the 'qf' parameter, it is only available for
> > > > dismax queries ( http://wiki.apache.org/solr/DisMaxQParserPlugin ).
> > Your
> > > > query becomes:
> > > > {!dismax qf=t_FIELD_NAME}TEST
> > > >
> > > > Have a look at the wiki (
> > > > http://wiki.apache.org/solr/CommonQueryParameters
> > > > ) for the syntax of your queries.
> > > >
> > > > Franck
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > http://lucene.472066.n3.nabble.com/url-encoded-strings-from-Admin-Query-String-search-tp3840910p3846003.html
> > > > Sent from the Solr - User mailing list archive at Nabble.com.
> > > >
> >
> >
> >



Re: url-encoded strings from Admin Query String search

Posted by Aaron Couch <aa...@zivtech.com>.
hi Chris and Hoss:

Thanks for the feedback. This is useful to hear. This seems like a bug to
me but not a very important one.

I'm new to Solr and seems like you have a great community here.

-Aaron

On Thu, Mar 22, 2012 at 1:34 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : The admin screen is made for doing a quick query against the default
> field
> : with the settings defined in the default search handler.  To that end, it
> : assumes that all entered characters should be part of the search string,
> so it
> : encodes them accordingly.
>
> correct ... that text box in question is simply the "q" param, and relies
> on defaults for everything else.  that is intentional.
>
> if you want to craft the url manally (using multiple params and taking
> care of your own escaping) you can do that directly in hte location bar --
> no need to type anything into the query form.
>
>
> -Hoss
>

Re: url-encoded strings from Admin Query String search

Posted by Chris Hostetter <ho...@fucit.org>.
: The admin screen is made for doing a quick query against the default field
: with the settings defined in the default search handler.  To that end, it
: assumes that all entered characters should be part of the search string, so it
: encodes them accordingly.

correct ... that text box in question is simply the "q" param, and relies 
on defaults for everything else.  that is intentional.

if you want to craft the url manally (using multiple params and taking 
care of your own escaping) you can do that directly in hte location bar -- 
no need to type anything into the query form.


-Hoss

Re: url-encoded strings from Admin Query String search

Posted by Shawn Heisey <so...@elyograg.org>.
On 3/21/2012 9:04 PM, Shawn Heisey wrote:
> The admin screen is made for doing a quick query against the default 
> field with the settings defined in the default search handler.  To 
> that end, it assumes that all entered characters should be part of the 
> search string, so it encodes them accordingly.
>
> On my version, which is 3.5.0, the main screen of the admin interface 
> has a "Full Interface" link that adds "form.jsp" to the URL and gives 
> a bunch more options.  The defType option is not there, but Query Type 
> is.  Depending on how you have your Solr configured, you may be able 
> to use that instead.

I forgot that you can specify fields, so part of my statement is wrong.  
It does use the default handler, though.

Shawn


Re: url-encoded strings from Admin Query String search

Posted by Shawn Heisey <so...@elyograg.org>.
On 3/21/2012 5:41 PM, Aaron Couch wrote:
> select/?q=t_title%3Aweb%26defType%3Dlucene
>
> The '&' and '%26' are not equivalent as well as the '=' and '%3D'.
>
> I know I could easily just type the queries correctly in the URL, but I'm
> giving a training where I'd like to show how the queries generated in our
> application can be tested and it would be great to be able to use the
> /admin screen or have a good reason why we can't.

The admin screen is made for doing a quick query against the default 
field with the settings defined in the default search handler.  To that 
end, it assumes that all entered characters should be part of the search 
string, so it encodes them accordingly.

On my version, which is 3.5.0, the main screen of the admin interface 
has a "Full Interface" link that adds "form.jsp" to the URL and gives a 
bunch more options.  The defType option is not there, but Query Type 
is.  Depending on how you have your Solr configured, you may be able to 
use that instead.

Shawn


Re: url-encoded strings from Admin Query String search

Posted by Aaron Couch <aa...@zivtech.com>.
Thanks again for the follow-up.

You are correct that '%3A' and ':' are equivalent. However if I type
anything else, for example if I want to change the query parser to Lucene,
the responseHeader returns an empty set.

If I type in the /admin screen:

t_FIELD_NAME:TEST&defType=lucene

I get:

select/?q=t_title%3Aweb%26defType%3Dlucene

The '&' and '%26' are not equivalent as well as the '=' and '%3D'.

I know I could easily just type the queries correctly in the URL, but I'm
giving a training where I'd like to show how the queries generated in our
application can be tested and it would be great to be able to use the
/admin screen or have a good reason why we can't.

Thanks again,

-Aaron

On Wed, Mar 21, 2012 at 1:52 PM, fbrisbart <fb...@bestofmedia.com>wrote:

> I'm not sure to understand your problem.
> The 2 urls :
> .../select/?q=t_FIELD_NAME%3ATEST
> and .../select/?q=t_FIELD_NAME:TEST
>
> are strictly the same.
>
> Look in the 'responseHeader', you'll see that query received is
> t_FIELD_NAME:TEST for both urls.
>
>
> Franck
>
>
> Le mercredi 21 mars 2012 à 12:36 -0500, Aaron Couch a écrit :
> > hi Franck;
> >
> > Thank you for your response. I'm not sure you understand my issue
> however.
> > I have dismax on by default so am able to use query fields.
> >
> > My problem is not in the queries themselves, but when they are input from
> > the '/admin' screen they are url-encoded.
> >
> > If I take your suggestion and type in t_FIELD_NAME:TEST the ''/admin
> screen
> > I get redirected to the following:
> >
> > select/?q=t_FIELD_NAME%3ATEST
> >
> > instead of:
> >
> > select/?q=t_FIELD_NAME:TEST
> >
> > Is there a setting I should be aware of to stop the /admin screen from
> > url-encoding strings? Or is there a setting to allow solr to accept
> > url-encoded strings? Is this issue fixed in later versions after 1.4?
> >
> > Thanks,
> >
> > -Aaron
> >
> >
> > On Wed, Mar 21, 2012 at 11:26 AM, fbrisbart <fbrisbart@bestofmedia.com
> >wrote:
> >
> > > Hi,
> > >
> > > for your example query 'TEST&qf=t_FIELD_NAME ',
> > > you can simply query :
> > > t_FIELD_NAME:TEST
> > >
> > > If you really want to use the 'qf' parameter, it is only available for
> > > dismax queries ( http://wiki.apache.org/solr/DisMaxQParserPlugin ).
> Your
> > > query becomes:
> > > {!dismax qf=t_FIELD_NAME}TEST
> > >
> > > Have a look at the wiki (
> > > http://wiki.apache.org/solr/CommonQueryParameters
> > > ) for the syntax of your queries.
> > >
> > > Franck
> > >
> > >
> > > --
> > > View this message in context:
> > >
> http://lucene.472066.n3.nabble.com/url-encoded-strings-from-Admin-Query-String-search-tp3840910p3846003.html
> > > Sent from the Solr - User mailing list archive at Nabble.com.
> > >
>
>
>

Re: url-encoded strings from Admin Query String search

Posted by fbrisbart <fb...@bestofmedia.com>.
I'm not sure to understand your problem.
The 2 urls :
.../select/?q=t_FIELD_NAME%3ATEST
and .../select/?q=t_FIELD_NAME:TEST

are strictly the same.

Look in the 'responseHeader', you'll see that query received is
t_FIELD_NAME:TEST for both urls.


Franck


Le mercredi 21 mars 2012 à 12:36 -0500, Aaron Couch a écrit :
> hi Franck;
> 
> Thank you for your response. I'm not sure you understand my issue however.
> I have dismax on by default so am able to use query fields.
> 
> My problem is not in the queries themselves, but when they are input from
> the '/admin' screen they are url-encoded.
> 
> If I take your suggestion and type in t_FIELD_NAME:TEST the ''/admin screen
> I get redirected to the following:
> 
> select/?q=t_FIELD_NAME%3ATEST
> 
> instead of:
> 
> select/?q=t_FIELD_NAME:TEST
> 
> Is there a setting I should be aware of to stop the /admin screen from
> url-encoding strings? Or is there a setting to allow solr to accept
> url-encoded strings? Is this issue fixed in later versions after 1.4?
> 
> Thanks,
> 
> -Aaron
> 
> 
> On Wed, Mar 21, 2012 at 11:26 AM, fbrisbart <fb...@bestofmedia.com>wrote:
> 
> > Hi,
> >
> > for your example query 'TEST&qf=t_FIELD_NAME ',
> > you can simply query :
> > t_FIELD_NAME:TEST
> >
> > If you really want to use the 'qf' parameter, it is only available for
> > dismax queries ( http://wiki.apache.org/solr/DisMaxQParserPlugin ). Your
> > query becomes:
> > {!dismax qf=t_FIELD_NAME}TEST
> >
> > Have a look at the wiki (
> > http://wiki.apache.org/solr/CommonQueryParameters
> > ) for the syntax of your queries.
> >
> > Franck
> >
> >
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/url-encoded-strings-from-Admin-Query-String-search-tp3840910p3846003.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >



Re: url-encoded strings from Admin Query String search

Posted by Aaron Couch <aa...@zivtech.com>.
hi Franck;

Thank you for your response. I'm not sure you understand my issue however.
I have dismax on by default so am able to use query fields.

My problem is not in the queries themselves, but when they are input from
the '/admin' screen they are url-encoded.

If I take your suggestion and type in t_FIELD_NAME:TEST the ''/admin screen
I get redirected to the following:

select/?q=t_FIELD_NAME%3ATEST

instead of:

select/?q=t_FIELD_NAME:TEST

Is there a setting I should be aware of to stop the /admin screen from
url-encoding strings? Or is there a setting to allow solr to accept
url-encoded strings? Is this issue fixed in later versions after 1.4?

Thanks,

-Aaron


On Wed, Mar 21, 2012 at 11:26 AM, fbrisbart <fb...@bestofmedia.com>wrote:

> Hi,
>
> for your example query 'TEST&qf=t_FIELD_NAME ',
> you can simply query :
> t_FIELD_NAME:TEST
>
> If you really want to use the 'qf' parameter, it is only available for
> dismax queries ( http://wiki.apache.org/solr/DisMaxQParserPlugin ). Your
> query becomes:
> {!dismax qf=t_FIELD_NAME}TEST
>
> Have a look at the wiki (
> http://wiki.apache.org/solr/CommonQueryParameters
> ) for the syntax of your queries.
>
> Franck
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/url-encoded-strings-from-Admin-Query-String-search-tp3840910p3846003.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: url-encoded strings from Admin Query String search

Posted by fbrisbart <fb...@bestofmedia.com>.
Hi,

for your example query 'TEST&qf=t_FIELD_NAME ',
you can simply query :
t_FIELD_NAME:TEST

If you really want to use the 'qf' parameter, it is only available for
dismax queries ( http://wiki.apache.org/solr/DisMaxQParserPlugin ). Your
query becomes:
{!dismax qf=t_FIELD_NAME}TEST

Have a look at the wiki ( http://wiki.apache.org/solr/CommonQueryParameters
) for the syntax of your queries.

Franck


--
View this message in context: http://lucene.472066.n3.nabble.com/url-encoded-strings-from-Admin-Query-String-search-tp3840910p3846003.html
Sent from the Solr - User mailing list archive at Nabble.com.