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 Peter Keegan <pe...@gmail.com> on 2014/10/22 19:21:51 UTC

QParserPlugin question

I have a custom query parser that modifies the filter query list based on
the keyword query. This works, but the 'fq' list in the responseHeader
contains the original filter list. The debugQuery output does display the
modified filter list. Is there a way to change the responseHeader? I could
probably do this in a custom QueryComponent, but the query parser seems
like a reasonable place to do this.

Thanks,
Peter

Re: QParserPlugin question

Posted by Peter Keegan <pe...@gmail.com>.
I meant to say: If the keyword is *:* (MachAllDocsQuery)...

On Wed, Oct 22, 2014 at 2:17 PM, Peter Keegan <pe...@gmail.com>
wrote:

> It's for an optimization. If the keyword is 'match all docs', I want to
> remove a custom PostFilter from the query and change the sort parameters
> (so the app doesn't have to do it).  It looks like the responseHeader is
> displaying the 'originalParams', which are immutable.
>
> On Wed, Oct 22, 2014 at 2:10 PM, Ramzi Alqrainy <ra...@gmail.com>
> wrote:
>
>> I don't know why you need to change it ? you can use &omitHeader=true on
>> the
>> URL to remove header if you want.
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/QParserPlugin-question-tp4165368p4165373.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>

Re: QParserPlugin question

Posted by Peter Keegan <pe...@gmail.com>.
Thanks for the advice. I've moved this query rewriting logic (not really
business logic) to a SearchComponent and will leave the custom query parser
to deal with the keyword (q=) related aspects of the query. In my case, the
latter is mostly dealing with the presence of wildcard characters.

Peter


On Wed, Oct 22, 2014 at 6:35 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : It's for an optimization. If the keyword is 'match all docs', I want to
> : remove a custom PostFilter from the query and change the sort parameters
> : (so the app doesn't have to do it).  It looks like the responseHeader is
> : displaying the 'originalParams', which are immutable.
>
> that is in fact the point of including the params in the header - to make
> it clear what exatly the request handler got as input.
>
> "echoParams" can be used to control wether you get "all" the params
> (including those added as defaults/appens in configuration) or just the
> "explicit" params included in the request -- but there's no way for a
> QParserPlugin to change what the raw query param strings are -- the query
> it produces might not even have a meaningful toString.
>
> the params in the header are there for the very explicit reason of showing
> you exactly what input was used to produce this request -- if plugins
> could change them, they would be meaningless since the modified params
> might not produce the same request.
>
> if you want to have a custom plugin that applies business logic to hcnage
> the behavior internally and reports back info for hte client to use in
> future requests, i would suggest doing that as a SearchComponent and
> inclding your own section in the response with details about what the
> client should do moving forward.
>
>
> (for example: i had a serach component once upon a time that applied
> QueryElevationComponent type checking against the query string & filters,
> and based on what it found would set the sort & add some filters unless an
> explicit sort / filter params were provided by the client -- the sort &
> filters that were added were included along with some additional metadat
> about what "rule" was matched in a new section of the response.)
>
>
> -Hoss
> http://www.lucidworks.com/
>

Re: QParserPlugin question

Posted by Chris Hostetter <ho...@fucit.org>.
: It's for an optimization. If the keyword is 'match all docs', I want to
: remove a custom PostFilter from the query and change the sort parameters
: (so the app doesn't have to do it).  It looks like the responseHeader is
: displaying the 'originalParams', which are immutable.

that is in fact the point of including the params in the header - to make 
it clear what exatly the request handler got as input.

"echoParams" can be used to control wether you get "all" the params 
(including those added as defaults/appens in configuration) or just the 
"explicit" params included in the request -- but there's no way for a 
QParserPlugin to change what the raw query param strings are -- the query 
it produces might not even have a meaningful toString.

the params in the header are there for the very explicit reason of showing 
you exactly what input was used to produce this request -- if plugins 
could change them, they would be meaningless since the modified params 
might not produce the same request.

if you want to have a custom plugin that applies business logic to hcnage 
the behavior internally and reports back info for hte client to use in 
future requests, i would suggest doing that as a SearchComponent and 
inclding your own section in the response with details about what the 
client should do moving forward.


(for example: i had a serach component once upon a time that applied 
QueryElevationComponent type checking against the query string & filters, 
and based on what it found would set the sort & add some filters unless an 
explicit sort / filter params were provided by the client -- the sort & 
filters that were added were included along with some additional metadat 
about what "rule" was matched in a new section of the response.)


-Hoss
http://www.lucidworks.com/

Re: QParserPlugin question

Posted by Peter Keegan <pe...@gmail.com>.
It's for an optimization. If the keyword is 'match all docs', I want to
remove a custom PostFilter from the query and change the sort parameters
(so the app doesn't have to do it).  It looks like the responseHeader is
displaying the 'originalParams', which are immutable.

On Wed, Oct 22, 2014 at 2:10 PM, Ramzi Alqrainy <ra...@gmail.com>
wrote:

> I don't know why you need to change it ? you can use &omitHeader=true on
> the
> URL to remove header if you want.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/QParserPlugin-question-tp4165368p4165373.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: QParserPlugin question

Posted by Ramzi Alqrainy <ra...@gmail.com>.
I don't know why you need to change it ? you can use &omitHeader=true on the
URL to remove header if you want.



--
View this message in context: http://lucene.472066.n3.nabble.com/QParserPlugin-question-tp4165368p4165373.html
Sent from the Solr - User mailing list archive at Nabble.com.