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 Stephen Duncan Jr <st...@gmail.com> on 2009/09/03 17:23:18 UTC

Default Query Type For Facet Queries

We have a custom query parser plugin registered as the default for searches,
and we'd like to have the same parser used for facet.query.

Is there a way to register it as the default for FacetComponent in
solrconfig.xml?

I know I can add {!type=customparser} to each query as a workaround, but I'd
rather register it in the config that make my code send that and strip it
off on every facet query.

-- 
Stephen Duncan Jr
www.stephenduncanjr.com

Re: Default Query Type For Facet Queries

Posted by Chris Hostetter <ho...@fucit.org>.
: You are right, SimpleFacets#getFacetQueryCounts has the following comment:
: 
: /* Ignore SolrParams.DF - could have init param facet.query assuming
:      * the schema default with query param DF intented to only affect Q.
:      * If user doesn't want schema default for facet.query, they should be
:      * explicit.
:      */

that comment is a red-herring...
 1) "DF" is the "df" param which changes the defaultField
 2) that comment refers to a line of code that is commented out because it 
    predates the Qparser stuff

However, Stephen's comments that changing defType didn't affect 
facet.query jogged my memory about something...

  https://issues.apache.org/jira/browse/SOLR-1025

...based on yonik's comments there, it sems intentional that defType isn't 
"inherited" by more parsers the the main one (either in other top level 
params, or in nested parsers)

The sub parsers trick could be useful here, hardcode...
  facet.query={!custom v=$custom.facet.query}
...as an invariant in solrconfig and then have your users pass the 
"custom.facet.query" param instead of "facet.query" ... btu that won't 
work for multivalued params.

For facet.query we could add a new param to the FacetComponent to 
default/invariant the parser, in the more general case of all params that 
might want parsing perhaps we could think of a new option that would let 
people declare a prefix on all params of a given name -- or a new option 
on the sub-parser syntax that would force the main param to be cloned for 
each instance of the sub param, so that something like...
  a={!foo s=t v=$$x}&x=1&x=2&b={!bar v=$y}y=8&y=9
...would be equivilent to...
  a={!foo s=t}1&a={!foo s=t}2&b={!bar}8

(note the "$$" in a and the "$" in b)

...something like that would be pretty cool, but a pain in the ass to 
implement (because right now the pultiparam code is completely isolated 
from the query parser code) ... it's pie in the sky, but maybel it will 
help people think of simpler/better alternatives.



-Hoss


Re: Default Query Type For Facet Queries

Posted by Lance Norskog <go...@gmail.com>.
There are also filter queries. Also, in the future we will also add
other query types for other features. Do we want them all to change?
Whatever we do, it should be consistent across all of the query types.

On Fri, Sep 11, 2009 at 9:33 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> On Sat, Sep 12, 2009 at 12:18 AM, Stephen Duncan Jr <
> stephen.duncan@gmail.com> wrote:
>
>> >
>> My experience (which is on a trunk build from a few weeks back of Solr
>> 2.4),
>> is that changing the default parser for the handler does NOT change it for
>> facet.query.  I had expected it would, but was disappointed.
>>
>>
> You are right, SimpleFacets#getFacetQueryCounts has the following comment:
>
> /* Ignore SolrParams.DF - could have init param facet.query assuming
>     * the schema default with query param DF intented to only affect Q.
>     * If user doesn't want schema default for facet.query, they should be
>     * explicit.
>     */
>
> I'm not sure if this should be changed. Hoss, what do you think?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
Lance Norskog
goksron@gmail.com

Re: Default Query Type For Facet Queries

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Sat, Sep 12, 2009 at 12:18 AM, Stephen Duncan Jr <
stephen.duncan@gmail.com> wrote:

> >
> My experience (which is on a trunk build from a few weeks back of Solr
> 2.4),
> is that changing the default parser for the handler does NOT change it for
> facet.query.  I had expected it would, but was disappointed.
>
>
You are right, SimpleFacets#getFacetQueryCounts has the following comment:

/* Ignore SolrParams.DF - could have init param facet.query assuming
     * the schema default with query param DF intented to only affect Q.
     * If user doesn't want schema default for facet.query, they should be
     * explicit.
     */

I'm not sure if this should be changed. Hoss, what do you think?

-- 
Regards,
Shalin Shekhar Mangar.

Re: Default Query Type For Facet Queries

Posted by Stephen Duncan Jr <st...@gmail.com>.
On Fri, Sep 11, 2009 at 2:36 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : I haven't experienced any such problems; it's just a query-parser plugin
> : that adds some behavior on top of the normal query parsing.  In any case,
> : even if I use a custom request handler with my custom parser, can I get
> : facet-queries to use this custom parser by default as well?
>
> if you change teh default parser for the entire handler, it should be used
> for all query parsing that doesn't use the {!foo} syntax ... but to answer
> your orriginal question there is no way to set the default for facet.query
> independently of the main default -- that would require a patch to the
> FacetComponent to look at init params (where it could find some
> default/invarrient params that would override the main ones)
>
>
> : > > > Is there a way to register it as the default for FacetComponent in
> : > > > solrconfig.xml?
>
>
>
> -Hoss
>
>
My experience (which is on a trunk build from a few weeks back of Solr 2.4),
is that changing the default parser for the handler does NOT change it for
facet.query.  I had expected it would, but was disappointed.

-- 
Stephen Duncan Jr
www.stephenduncanjr.com

Re: Default Query Type For Facet Queries

Posted by Chris Hostetter <ho...@fucit.org>.
: I haven't experienced any such problems; it's just a query-parser plugin
: that adds some behavior on top of the normal query parsing.  In any case,
: even if I use a custom request handler with my custom parser, can I get
: facet-queries to use this custom parser by default as well?

if you change teh default parser for the entire handler, it should be used 
for all query parsing that doesn't use the {!foo} syntax ... but to answer 
your orriginal question there is no way to set the default for facet.query 
independently of the main default -- that would require a patch to the 
FacetComponent to look at init params (where it could find some 
default/invarrient params that would override the main ones)


: > > > Is there a way to register it as the default for FacetComponent in
: > > > solrconfig.xml?



-Hoss


Re: Default Query Type For Facet Queries

Posted by Stephen Duncan Jr <st...@gmail.com>.
I haven't experienced any such problems; it's just a query-parser plugin
that adds some behavior on top of the normal query parsing.  In any case,
even if I use a custom request handler with my custom parser, can I get
facet-queries to use this custom parser by default as well?

-Stephen

On Thu, Sep 10, 2009 at 11:30 PM, Lance Norskog <go...@gmail.com> wrote:

> Changing basic defaults like this makes it very confusing to work with
> successive solr releases, to read the wiki, etc.
>
> You can make custom search requesthandlers - an example:
>
>  <requestHandler name="/custom" class="solr.SearchHandler" >
>     <lst name="invariants">
>         <str name="defType">customparser</str>
>
> http://localhost:8983/solr/custom?q=string_in_my_custom_language
>
> On 9/10/09, Stephen Duncan Jr <st...@gmail.com> wrote:
> > If using {!type=customparser} is the only way now, should I file an issue
> to
> > make the default configurable?
> >
> > --
> > Stephen Duncan Jr
> > www.stephenduncanjr.com
> >
> > On Thu, Sep 3, 2009 at 11:23 AM, Stephen Duncan Jr <
> stephen.duncan@gmail.com
> > > wrote:
> >
> > > We have a custom query parser plugin registered as the default for
> > > searches, and we'd like to have the same parser used for facet.query.
> > >
> > > Is there a way to register it as the default for FacetComponent in
> > > solrconfig.xml?
> > >
> > > I know I can add {!type=customparser} to each query as a workaround,
> but
> > > I'd rather register it in the config that make my code send that and
> strip
> > > it off on every facet query.
> > >
> > > --
> > > Stephen Duncan Jr
> > > www.stephenduncanjr.com
> > >
> >
>
>
>
> --
> Lance Norskog
> goksron@gmail.com
>

Re: Default Query Type For Facet Queries

Posted by Lance Norskog <go...@gmail.com>.
Changing basic defaults like this makes it very confusing to work with
successive solr releases, to read the wiki, etc.

You can make custom search requesthandlers - an example:

 <requestHandler name="/custom" class="solr.SearchHandler" >
    <lst name="invariants">
        <str name="defType">customparser</str>

http://localhost:8983/solr/custom?q=string_in_my_custom_language

On 9/10/09, Stephen Duncan Jr <st...@gmail.com> wrote:
> If using {!type=customparser} is the only way now, should I file an issue to
> make the default configurable?
>
> --
> Stephen Duncan Jr
> www.stephenduncanjr.com
>
> On Thu, Sep 3, 2009 at 11:23 AM, Stephen Duncan Jr <stephen.duncan@gmail.com
> > wrote:
>
> > We have a custom query parser plugin registered as the default for
> > searches, and we'd like to have the same parser used for facet.query.
> >
> > Is there a way to register it as the default for FacetComponent in
> > solrconfig.xml?
> >
> > I know I can add {!type=customparser} to each query as a workaround, but
> > I'd rather register it in the config that make my code send that and strip
> > it off on every facet query.
> >
> > --
> > Stephen Duncan Jr
> > www.stephenduncanjr.com
> >
>



-- 
Lance Norskog
goksron@gmail.com

Re: Default Query Type For Facet Queries

Posted by Stephen Duncan Jr <st...@gmail.com>.
If using {!type=customparser} is the only way now, should I file an issue to
make the default configurable?

-- 
Stephen Duncan Jr
www.stephenduncanjr.com

On Thu, Sep 3, 2009 at 11:23 AM, Stephen Duncan Jr <stephen.duncan@gmail.com
> wrote:

> We have a custom query parser plugin registered as the default for
> searches, and we'd like to have the same parser used for facet.query.
>
> Is there a way to register it as the default for FacetComponent in
> solrconfig.xml?
>
> I know I can add {!type=customparser} to each query as a workaround, but
> I'd rather register it in the config that make my code send that and strip
> it off on every facet query.
>
> --
> Stephen Duncan Jr
> www.stephenduncanjr.com
>