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 Shawn Heisey <so...@elyograg.org> on 2013/11/13 02:34:40 UTC

Re: Modify the querySearch to q=*:*

On 11/12/2013 6:03 PM, Abhijith Jain -X (abhijjai - DIGITAL-X INC at 
Cisco) wrote:
> I am trying to set the query to q=*:* permanently. I tried to set q=*:* in SolrConfig.xml file as follows.
>
> <requestHandler name="standard" class="solr.SearchHandler" default="true">
>                  <lst name="defaults">
>                          <str name="echoParams">none</str>
>                          <str name="q">*:*</str>
>                  </lst>
>          </requestHandler>
>
> But this didn’t help. Please advise how to change query to q=*:* in Solr 4.4.

This configuration sets the default for the q parameter to *:*, but if 
the actual query that is sent to Solr has a q parameter, it will 
override that default.

In the very unlikely situation that you don't want to ever do any query 
besides *:*, you can put that setting into the invariants section 
instead of the defaults section - but be aware that if you do that, you 
will never be able to send any other query.Normally your application 
decides what the query string should be, not Solr.

I concur with Jack's recommendation that you migrate to the 4.x way of 
naming handlers.  You would need to set handleSelect to false and change 
all your search handlers so their name starts with a slash.  The one 
that is currently named "standard" would instead be named "/select" and 
you would need to remove the default="true" setting.

Thanks,
Shawn


Re: Modify the querySearch to q=*:*

Posted by Jack Krupansky <ja...@basetechnology.com>.
Just in case anybody is curious what *\* would really mean, the backslash 
means to escape the following character, which in this case means don't 
treat the second asterisk as a wildcard, but since the initial asterisk was 
not escaped (the full rule is that if there is any unescaped wildcard in a 
term then all of the escaped wildcards are treated as unescaped since Lucene 
has no support for escaping in WildcardQuery), any escaping of wildcards in 
the term is ignored, so *\* is treated as **, and ** is redundant and 
matches the same as *, so a *\* query would simply match all documents that 
have a value in the default search field. In many cases this would give 
identical results to a *:* query, but in some apps it might not.

Still it would be nice to know who originated this suggestion to use *\* 
instead of *:* - or even simply *.

-- Jack Krupansky

-----Original Message----- 
From: Alvaro Cabrerizo
Sent: Wednesday, November 13, 2013 4:16 AM
To: solr-user@lucene.apache.org
Subject: Re: Modify the querySearch to q=*:*

Hi:

First of all I have to say that I had never heard about *\* as the query to
get all the documents in a index but *:*  (maybe I'm wrong) . Re-reading
"Apache Solr 4 cookbook", "Solr 1.4 Enterprise Search Server" and " Apache
Solr 3 Enterprise Search Server" there is no trace for the query *\* as the
universal query to get every doc.

If you enable 
debugQuery<http://wiki.apache.org/solr/CommonQueryParameters#debugQuery>
you
can see that *:* is transformed into "MatchAllDocsQuery(*:*) (Solr1.4 and
Solr4.4) wich means give me all the documents, but the query *\* is
transformed into other thing (In my case having a default field called
description defined in the schema) I get in Solr1.4 description:*\\* wich
means give all the documents that have the char \ in the field description
and in SOLR1.4  I get description:** which also gets all the documents in
the index. It would be helpful to see how is interpreted *\* in your system
(solr3.5 and solr4).

I think, the best way to solve your problem Is to modify the system which
launches the request to SOLR and modify *\* by *:* (if it is possible). I
dont know if SOLR can make that kind of translation, I mean change *\* by
*:*.  One possible workaround with collateral damages is the inclusion of a
PatternReplaceCharFilterFactory (in schema.xml) within the fieldtypes you
use to search in order to delete every \ character included in the input or
even include the expression to transform *\* into *:* . But including that
element in your schema means that it will always be used during your search
(thus if your users type a\b they will search ab). If you want to explore
that path I recommend you to use the analysis
tool<https://cwiki.apache.org/confluence/display/solr/Analysis+Screen>included
in solr.

Regards.













On Wed, Nov 13, 2013 at 2:34 AM, Shawn Heisey <so...@elyograg.org> wrote:

> On 11/12/2013 6:03 PM, Abhijith Jain -X (abhijjai - DIGITAL-X INC at
> Cisco) wrote:
>
>> I am trying to set the query to q=*:* permanently. I tried to set q=*:*
>> in SolrConfig.xml file as follows.
>>
>> <requestHandler name="standard" class="solr.SearchHandler" 
>> default="true">
>>                  <lst name="defaults">
>>                          <str name="echoParams">none</str>
>>                          <str name="q">*:*</str>
>>                  </lst>
>>          </requestHandler>
>>
>> But this didn’t help. Please advise how to change query to q=*:* in Solr
>> 4.4.
>>
>
> This configuration sets the default for the q parameter to *:*, but if the
> actual query that is sent to Solr has a q parameter, it will override that
> default.
>
> In the very unlikely situation that you don't want to ever do any query
> besides *:*, you can put that setting into the invariants section instead
> of the defaults section - but be aware that if you do that, you will never
> be able to send any other query.Normally your application decides what the
> query string should be, not Solr.
>
> I concur with Jack's recommendation that you migrate to the 4.x way of
> naming handlers.  You would need to set handleSelect to false and change
> all your search handlers so their name starts with a slash.  The one that
> is currently named "standard" would instead be named "/select" and you
> would need to remove the default="true" setting.
>
> Thanks,
> Shawn
>
> 


Re: Modify the querySearch to q=*:*

Posted by Alvaro Cabrerizo <to...@gmail.com>.
Hi:

First of all I have to say that I had never heard about *\* as the query to
get all the documents in a index but *:*  (maybe I'm wrong) . Re-reading
"Apache Solr 4 cookbook", "Solr 1.4 Enterprise Search Server" and " Apache
Solr 3 Enterprise Search Server" there is no trace for the query *\* as the
universal query to get every doc.

If you enable debugQuery<http://wiki.apache.org/solr/CommonQueryParameters#debugQuery>
you
can see that *:* is transformed into "MatchAllDocsQuery(*:*) (Solr1.4 and
Solr4.4) wich means give me all the documents, but the query *\* is
transformed into other thing (In my case having a default field called
description defined in the schema) I get in Solr1.4 description:*\\* wich
means give all the documents that have the char \ in the field description
and in SOLR1.4  I get description:** which also gets all the documents in
the index. It would be helpful to see how is interpreted *\* in your system
(solr3.5 and solr4).

I think, the best way to solve your problem Is to modify the system which
launches the request to SOLR and modify *\* by *:* (if it is possible). I
dont know if SOLR can make that kind of translation, I mean change *\* by
*:*.  One possible workaround with collateral damages is the inclusion of a
PatternReplaceCharFilterFactory (in schema.xml) within the fieldtypes you
use to search in order to delete every \ character included in the input or
even include the expression to transform *\* into *:* . But including that
element in your schema means that it will always be used during your search
(thus if your users type a\b they will search ab). If you want to explore
that path I recommend you to use the analysis
tool<https://cwiki.apache.org/confluence/display/solr/Analysis+Screen>included
in solr.

Regards.













On Wed, Nov 13, 2013 at 2:34 AM, Shawn Heisey <so...@elyograg.org> wrote:

> On 11/12/2013 6:03 PM, Abhijith Jain -X (abhijjai - DIGITAL-X INC at
> Cisco) wrote:
>
>> I am trying to set the query to q=*:* permanently. I tried to set q=*:*
>> in SolrConfig.xml file as follows.
>>
>> <requestHandler name="standard" class="solr.SearchHandler" default="true">
>>                  <lst name="defaults">
>>                          <str name="echoParams">none</str>
>>                          <str name="q">*:*</str>
>>                  </lst>
>>          </requestHandler>
>>
>> But this didn’t help. Please advise how to change query to q=*:* in Solr
>> 4.4.
>>
>
> This configuration sets the default for the q parameter to *:*, but if the
> actual query that is sent to Solr has a q parameter, it will override that
> default.
>
> In the very unlikely situation that you don't want to ever do any query
> besides *:*, you can put that setting into the invariants section instead
> of the defaults section - but be aware that if you do that, you will never
> be able to send any other query.Normally your application decides what the
> query string should be, not Solr.
>
> I concur with Jack's recommendation that you migrate to the 4.x way of
> naming handlers.  You would need to set handleSelect to false and change
> all your search handlers so their name starts with a slash.  The one that
> is currently named "standard" would instead be named "/select" and you
> would need to remove the default="true" setting.
>
> Thanks,
> Shawn
>
>