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 "Beale, Jim (US-KOP)" <Ji...@hibu.com> on 2016/08/09 17:23:01 UTC

Modifying fl in QParser

Hi,

Is it possible to modify the SolrParam, fl, to append selected dynamic fields, while rewriting a query in QParser.parse()?

Thanks in advance!


Jim Beale
Senior Lead Developer
2201 Renaissance Boulevard, King of Prussia, PA, 19406
Mobile: 610-220-3067

[cid:image001.png@01CD6E5F.BE5E6C20]

The information contained in this email message, including any attachments, is intended solely for use by the individual or entity named above and may be confidential. If the reader of this message is not the intended recipient, you are hereby notified that you must not read, use, disclose, distribute or copy any part of this communication. If you have received this communication in error, please immediately notify me by email and destroy the original message, including any attachments. Thank you. **hibu IT Code:1414593000000**

Re: Modifying fl in QParser

Posted by Erik Hatcher <er...@gmail.com>.
And it's not necessary to override QueryComponent to set params.  I think I'd add a first-params SearchComponent, so you're decoupling and plugging in extra behavior rather than overriding kinda the heart of Solr.  
   
    Erik

> On Aug 30, 2016, at 21:42, Rohit Kanchan <ro...@gmail.com> wrote:
> 
> We are dealing with same thing, we have overridden QueryComponent (type of
> SearchComponent) and added a field to retrieve there. That same field we
> are setting in SolrParams from query request. According to your business
> you need to figure out  how you can override QueryComponent. I hope this
> helps in solving your problem.
> 
> Thanks
> Rohit Kanchan
> 
> 
> On Tue, Aug 30, 2016 at 5:11 PM, Erik Hatcher <er...@gmail.com>
> wrote:
> 
>> Personally, I don’t think a QParser(Plugin) is the right place to modify
>> other parameters, only to create a Query object.   A QParser could be
>> invoked from an fq, not just a q, and will get invoked on multiple nodes in
>> SolrCloud, for example - this is why I think it’s not a good idea to do
>> anything but return a Query.
>> 
>> It is possible (in fact I’m dealing with this very situation with a client
>> as we speak) to set parameters this way, but I don’t recommend it.   Create
>> a SearchComponent to do this job instead.
>> 
>>        Erik
>> 
>> 
>> 
>>> On Aug 9, 2016, at 10:23 AM, Beale, Jim (US-KOP) <Ji...@hibu.com>
>> wrote:
>>> 
>>> Hi,
>>> 
>>> Is it possible to modify the SolrParam, fl, to append selected dynamic
>> fields, while rewriting a query in QParser.parse()?
>>> 
>>> Thanks in advance!
>>> 
>>> 
>>> Jim Beale
>>> Senior Lead Developer
>>> 2201 Renaissance Boulevard, King of Prussia, PA, 19406
>>> Mobile: 610-220-3067
>>> 
>>> 
>>> 
>>> The information contained in this email message, including any
>> attachments, is intended solely for use by the individual or entity named
>> above and may be confidential. If the reader of this message is not the
>> intended recipient, you are hereby notified that you must not read, use,
>> disclose, distribute or copy any part of this communication. If you have
>> received this communication in error, please immediately notify me by email
>> and destroy the original message, including any attachments. Thank you.
>> **hibu IT Code:1414593000000**
>> 
>> 

RE: Modifying fl in QParser

Posted by "Beale, Jim (US-KOP)" <Ji...@hibu.com>.
All,

Thank you all for your responses.

Our custom QParser identifies several of many dynamic fields for construction of the actual Lucene query.  

For instance, given a custom Solr request consisting of "q={!xyzQP}scid:500247", a new query is to be constructed using information from a SQL query which selects certain dynamic fields, e.g. p_001, q_004, r_007 along the lines of "+p_001:abc +q_004:abc +r_007:abc".  The requirement is to then configure fl to only include the stored fields psf_001, qsf_004 and rsf_007 in the response, but not the many other stored fields that are not relevant to the query.

What is the best way to accomplish this?  It would be convenient to be able to modify fl in the QParser.

Also, note that the index is not sharded. 

Thanks!

Jim

-----Original Message-----
From: Rohit Kanchan [mailto:rohitkan2000@gmail.com] 
Sent: Wednesday, August 31, 2016 12:42 AM
To: solr-user@lucene.apache.org
Subject: Re: Modifying fl in QParser

We are dealing with same thing, we have overridden QueryComponent (type of
SearchComponent) and added a field to retrieve there. That same field we are setting in SolrParams from query request. According to your business you need to figure out  how you can override QueryComponent. I hope this helps in solving your problem.

Thanks
Rohit Kanchan


On Tue, Aug 30, 2016 at 5:11 PM, Erik Hatcher <er...@gmail.com>
wrote:

> Personally, I don’t think a QParser(Plugin) is the right place to modify
> other parameters, only to create a Query object.   A QParser could be
> invoked from an fq, not just a q, and will get invoked on multiple 
> nodes in SolrCloud, for example - this is why I think it’s not a good 
> idea to do anything but return a Query.
>
> It is possible (in fact I’m dealing with this very situation with a client
> as we speak) to set parameters this way, but I don’t recommend it.   Create
> a SearchComponent to do this job instead.
>
>         Erik
>
>
>
> > On Aug 9, 2016, at 10:23 AM, Beale, Jim (US-KOP) 
> > <Ji...@hibu.com>
> wrote:
> >
> > Hi,
> >
> > Is it possible to modify the SolrParam, fl, to append selected 
> > dynamic
> fields, while rewriting a query in QParser.parse()?
> >
> > Thanks in advance!
> >
> >
> > Jim Beale
> > Senior Lead Developer
> > 2201 Renaissance Boulevard, King of Prussia, PA, 19406
> > Mobile: 610-220-3067
> >
> >
> >
> > The information contained in this email message, including any
> attachments, is intended solely for use by the individual or entity 
> named above and may be confidential. If the reader of this message is 
> not the intended recipient, you are hereby notified that you must not 
> read, use, disclose, distribute or copy any part of this 
> communication. If you have received this communication in error, 
> please immediately notify me by email and destroy the original message, including any attachments. Thank you.
> **hibu IT Code:1414593000000**
>
>

Re: Modifying fl in QParser

Posted by Rohit Kanchan <ro...@gmail.com>.
We are dealing with same thing, we have overridden QueryComponent (type of
SearchComponent) and added a field to retrieve there. That same field we
are setting in SolrParams from query request. According to your business
you need to figure out  how you can override QueryComponent. I hope this
helps in solving your problem.

Thanks
Rohit Kanchan


On Tue, Aug 30, 2016 at 5:11 PM, Erik Hatcher <er...@gmail.com>
wrote:

> Personally, I don’t think a QParser(Plugin) is the right place to modify
> other parameters, only to create a Query object.   A QParser could be
> invoked from an fq, not just a q, and will get invoked on multiple nodes in
> SolrCloud, for example - this is why I think it’s not a good idea to do
> anything but return a Query.
>
> It is possible (in fact I’m dealing with this very situation with a client
> as we speak) to set parameters this way, but I don’t recommend it.   Create
> a SearchComponent to do this job instead.
>
>         Erik
>
>
>
> > On Aug 9, 2016, at 10:23 AM, Beale, Jim (US-KOP) <Ji...@hibu.com>
> wrote:
> >
> > Hi,
> >
> > Is it possible to modify the SolrParam, fl, to append selected dynamic
> fields, while rewriting a query in QParser.parse()?
> >
> > Thanks in advance!
> >
> >
> > Jim Beale
> > Senior Lead Developer
> > 2201 Renaissance Boulevard, King of Prussia, PA, 19406
> > Mobile: 610-220-3067
> >
> >
> >
> > The information contained in this email message, including any
> attachments, is intended solely for use by the individual or entity named
> above and may be confidential. If the reader of this message is not the
> intended recipient, you are hereby notified that you must not read, use,
> disclose, distribute or copy any part of this communication. If you have
> received this communication in error, please immediately notify me by email
> and destroy the original message, including any attachments. Thank you.
> **hibu IT Code:1414593000000**
>
>

Re: Modifying fl in QParser

Posted by Erik Hatcher <er...@gmail.com>.
Personally, I don’t think a QParser(Plugin) is the right place to modify other parameters, only to create a Query object.   A QParser could be invoked from an fq, not just a q, and will get invoked on multiple nodes in SolrCloud, for example - this is why I think it’s not a good idea to do anything but return a Query.

It is possible (in fact I’m dealing with this very situation with a client as we speak) to set parameters this way, but I don’t recommend it.   Create a SearchComponent to do this job instead.

	Erik



> On Aug 9, 2016, at 10:23 AM, Beale, Jim (US-KOP) <Ji...@hibu.com> wrote:
> 
> Hi,
>  
> Is it possible to modify the SolrParam, fl, to append selected dynamic fields, while rewriting a query in QParser.parse()?  
>  
> Thanks in advance! 
>  
>  
> Jim Beale
> Senior Lead Developer
> 2201 Renaissance Boulevard, King of Prussia, PA, 19406
> Mobile: 610-220-3067
>  
> 
>  
> The information contained in this email message, including any attachments, is intended solely for use by the individual or entity named above and may be confidential. If the reader of this message is not the intended recipient, you are hereby notified that you must not read, use, disclose, distribute or copy any part of this communication. If you have received this communication in error, please immediately notify me by email and destroy the original message, including any attachments. Thank you. **hibu IT Code:1414593000000**


RE: Modifying fl in QParser

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Your question is too dense. I, for one, have trouble parsing it, no pun
intended.

Could you expand it a little bit with business level problem, what you are
trying to achieve and what specifically is not working.

P.s. Also, many of us are in a different timezone from you and expecting a
response in a couple of hours for something like this might be a bit ....
premature.

On 31 Aug 2016 4:22 AM, "Beale, Jim (US-KOP)" <Ji...@hibu.com> wrote:

> Anyone??
>
> From: Beale, Jim (US-KOP) [mailto:Jim.Beale@hibu.com]
> Sent: Tuesday, August 09, 2016 1:23 PM
> To: solr-user@lucene.apache.org
> Subject: Modifying fl in QParser
>
> Hi,
>
> Is it possible to modify the SolrParam, fl, to append selected dynamic
> fields, while rewriting a query in QParser.parse()?
>
> Thanks in advance!
>
>
> Jim Beale
> Senior Lead Developer
> 2201 Renaissance Boulevard, King of Prussia, PA, 19406
> Mobile: 610-220-3067
>
> [cid:image001.png@01CD6E5F.BE5E6C20]
>
> The information contained in this email message, including any
> attachments, is intended solely for use by the individual or entity named
> above and may be confidential. If the reader of this message is not the
> intended recipient, you are hereby notified that you must not read, use,
> disclose, distribute or copy any part of this communication. If you have
> received this communication in error, please immediately notify me by email
> and destroy the original message, including any attachments. Thank you.
> **hibu IT Code:1414593000000**
>

RE: Modifying fl in QParser

Posted by "Beale, Jim (US-KOP)" <Ji...@hibu.com>.
Anyone??

From: Beale, Jim (US-KOP) [mailto:Jim.Beale@hibu.com]
Sent: Tuesday, August 09, 2016 1:23 PM
To: solr-user@lucene.apache.org
Subject: Modifying fl in QParser

Hi,

Is it possible to modify the SolrParam, fl, to append selected dynamic fields, while rewriting a query in QParser.parse()?

Thanks in advance!


Jim Beale
Senior Lead Developer
2201 Renaissance Boulevard, King of Prussia, PA, 19406
Mobile: 610-220-3067

[cid:image001.png@01CD6E5F.BE5E6C20]

The information contained in this email message, including any attachments, is intended solely for use by the individual or entity named above and may be confidential. If the reader of this message is not the intended recipient, you are hereby notified that you must not read, use, disclose, distribute or copy any part of this communication. If you have received this communication in error, please immediately notify me by email and destroy the original message, including any attachments. Thank you. **hibu IT Code:1414593000000**