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 Solrmails <so...@protonmail.com> on 2017/12/19 08:22:59 UTC

How to restrict the fields solr returns?

Hey

I'm using a custom "QParserPlugin" to restrict which documents are returned to the user.
Now I'd like to restrict also the fields that are returned with a document. I couldn't find a good entry point to do such a restriction. Maybe I  could missuse a "QueryResponseWriter" plugin but that sounds like a bad idea.

Any other ideas?

Re: How to restrict the fields solr returns?

Posted by Emir Arnautović <em...@sematext.com>.
In addition to that, you can use invariants to disallow overriding it.

Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 19 Dec 2017, at 14:23, Diego Ceccarelli <di...@gmail.com> wrote:
> 
> If you need to return only a subset of the fields for each request you can
> set them as default in the solrconfig.xml.
> 
> On Dec 19, 2017 13:45, "Solrmails" <so...@protonmail.com> wrote:
> 
>> I found a solution: I created a custom Search Handler and overridden
>> 'handleRequestBody'. Then I modify the "getParams" collection within
>> 'handleRequestBody' to enforce the fl param.
>> 
>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>> 
>>> -------- Original Message --------
>>> Subject: Re: How to restrict the fields solr returns?
>>> Local Time: 19 December 2017 1:02 PM
>>> UTC Time: 19 December 2017 12:02
>>> From: rleir@leirtech.com
>>> To: solr-user@lucene.apache.org
>>> 
>>> The fl parameter is used for this.
>>> 
>>> On December 19, 2017 3:22:59 AM EST, Solrmails solrmails@protonmail.com
>> wrote:
>>> 
>>>> Hey
>>>> I'm using a custom "QParserPlugin" to restrict which documents are
>>>> returned to the user.
>>>> Now I'd like to restrict also the fields that are returned with a
>>>> document. I couldn't find a good entry point to do such a restriction.
>>>> Maybe I could missuse a "QueryResponseWriter" plugin but that sounds
>>>> like a bad idea.
>>>> Any other ideas?
>>>> 
>>>> --
>>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com


Re: How to restrict the fields solr returns?

Posted by Diego Ceccarelli <di...@gmail.com>.
Instead of putting this into Solr, did you consider adding this logic
into the service that will call Solr?

On Tue, Dec 19, 2017 at 4:41 PM, Solrmails <so...@protonmail.com> wrote:
> Thank you for your answer. I'd like to restrict the returned fields dynamicaly based on a permission system. I think modifieng the "getParams" collection to add fl within the 'handleRequestBody'(CustomSearchHandler) should do the work?
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>
>> -------- Original Message --------
>> Subject: Re: How to restrict the fields solr returns?
>> Local Time: 19 December 2017 2:23 PM
>> UTC Time: 19 December 2017 13:23
>> From: diego.ceccarelli@gmail.com
>> To: solr-user@lucene.apache.org, Solrmails <so...@protonmail.com>
>>
>> If you need to return only a subset of the fields for each request you can
>> set them as default in the solrconfig.xml.
>>
>> On Dec 19, 2017 13:45, "Solrmails" solrmails@protonmail.com wrote:
>>
>>> I found a solution: I created a custom Search Handler and overridden
>>> 'handleRequestBody'. Then I modify the "getParams" collection within
>>> 'handleRequestBody' to enforce the fl param.
>>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>>>
>>>> -------- Original Message --------
>>>> Subject: Re: How to restrict the fields solr returns?
>>>> Local Time: 19 December 2017 1:02 PM
>>>> UTC Time: 19 December 2017 12:02
>>>> From: rleir@leirtech.com
>>>> To: solr-user@lucene.apache.org
>>>> The fl parameter is used for this.
>>>> On December 19, 2017 3:22:59 AM EST, Solrmails solrmails@protonmail.com
>>>> wrote:
>>>>
>>>>> Hey
>>>>> I'm using a custom "QParserPlugin" to restrict which documents are
>>>>> returned to the user.
>>>>> Now I'd like to restrict also the fields that are returned with a
>>>>> document. I couldn't find a good entry point to do such a restriction.
>>>>> Maybe I could missuse a "QueryResponseWriter" plugin but that sounds
>>>>> like a bad idea.
>>>>> Any other ideas?
>>>>> --
>>>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com

Re: How to restrict the fields solr returns?

Posted by Solrmails <so...@protonmail.com>.
Thank you for your answer. I'd like to restrict the returned fields dynamicaly based on a permission system. I think modifieng the "getParams" collection to add fl within the 'handleRequestBody'(CustomSearchHandler) should do the work?

Sent with [ProtonMail](https://protonmail.com) Secure Email.

> -------- Original Message --------
> Subject: Re: How to restrict the fields solr returns?
> Local Time: 19 December 2017 2:23 PM
> UTC Time: 19 December 2017 13:23
> From: diego.ceccarelli@gmail.com
> To: solr-user@lucene.apache.org, Solrmails <so...@protonmail.com>
>
> If you need to return only a subset of the fields for each request you can
> set them as default in the solrconfig.xml.
>
> On Dec 19, 2017 13:45, "Solrmails" solrmails@protonmail.com wrote:
>
>> I found a solution: I created a custom Search Handler and overridden
>> 'handleRequestBody'. Then I modify the "getParams" collection within
>> 'handleRequestBody' to enforce the fl param.
>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>>
>>> -------- Original Message --------
>>> Subject: Re: How to restrict the fields solr returns?
>>> Local Time: 19 December 2017 1:02 PM
>>> UTC Time: 19 December 2017 12:02
>>> From: rleir@leirtech.com
>>> To: solr-user@lucene.apache.org
>>> The fl parameter is used for this.
>>> On December 19, 2017 3:22:59 AM EST, Solrmails solrmails@protonmail.com
>>> wrote:
>>>
>>>> Hey
>>>> I'm using a custom "QParserPlugin" to restrict which documents are
>>>> returned to the user.
>>>> Now I'd like to restrict also the fields that are returned with a
>>>> document. I couldn't find a good entry point to do such a restriction.
>>>> Maybe I could missuse a "QueryResponseWriter" plugin but that sounds
>>>> like a bad idea.
>>>> Any other ideas?
>>>> --
>>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com

Re: How to restrict the fields solr returns?

Posted by Diego Ceccarelli <di...@gmail.com>.
If you need to return only a subset of the fields for each request you can
set them as default in the solrconfig.xml.

On Dec 19, 2017 13:45, "Solrmails" <so...@protonmail.com> wrote:

> I found a solution: I created a custom Search Handler and overridden
> 'handleRequestBody'. Then I modify the "getParams" collection within
> 'handleRequestBody' to enforce the fl param.
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>
> > -------- Original Message --------
> > Subject: Re: How to restrict the fields solr returns?
> > Local Time: 19 December 2017 1:02 PM
> > UTC Time: 19 December 2017 12:02
> > From: rleir@leirtech.com
> > To: solr-user@lucene.apache.org
> >
> > The fl parameter is used for this.
> >
> > On December 19, 2017 3:22:59 AM EST, Solrmails solrmails@protonmail.com
> wrote:
> >
> >> Hey
> >> I'm using a custom "QParserPlugin" to restrict which documents are
> >> returned to the user.
> >> Now I'd like to restrict also the fields that are returned with a
> >> document. I couldn't find a good entry point to do such a restriction.
> >> Maybe I could missuse a "QueryResponseWriter" plugin but that sounds
> >> like a bad idea.
> >> Any other ideas?
> >>
> >> --
> >> Sorry for being brief. Alternate email is rickleir at yahoo dot com

Re: How to restrict the fields solr returns?

Posted by Solrmails <so...@protonmail.com>.
I found a solution: I created a custom Search Handler and overridden 'handleRequestBody'. Then I modify the "getParams" collection within 'handleRequestBody' to enforce the fl param.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

> -------- Original Message --------
> Subject: Re: How to restrict the fields solr returns?
> Local Time: 19 December 2017 1:02 PM
> UTC Time: 19 December 2017 12:02
> From: rleir@leirtech.com
> To: solr-user@lucene.apache.org
>
> The fl parameter is used for this.
>
> On December 19, 2017 3:22:59 AM EST, Solrmails solrmails@protonmail.com wrote:
>
>> Hey
>> I'm using a custom "QParserPlugin" to restrict which documents are
>> returned to the user.
>> Now I'd like to restrict also the fields that are returned with a
>> document. I couldn't find a good entry point to do such a restriction.
>> Maybe I could missuse a "QueryResponseWriter" plugin but that sounds
>> like a bad idea.
>> Any other ideas?
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com

Re: How to restrict the fields solr returns?

Posted by Rick Leir <rl...@leirtech.com>.
The fl parameter is used for this.

On December 19, 2017 3:22:59 AM EST, Solrmails <so...@protonmail.com> wrote:
>Hey
>
>I'm using a custom "QParserPlugin" to restrict which documents are
>returned to the user.
>Now I'd like to restrict also the fields that are returned with a
>document. I couldn't find a good entry point to do such a restriction.
>Maybe I  could missuse a "QueryResponseWriter" plugin but that sounds
>like a bad idea.
>
>Any other ideas?

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: How to restrict the fields solr returns?

Posted by Emir Arnautović <em...@sematext.com>.
Hi,
You could write custom search component that can be included in your request handler.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 19 Dec 2017, at 09:22, Solrmails <so...@protonmail.com> wrote:
> 
> Hey
> 
> I'm using a custom "QParserPlugin" to restrict which documents are returned to the user.
> Now I'd like to restrict also the fields that are returned with a document. I couldn't find a good entry point to do such a restriction. Maybe I  could missuse a "QueryResponseWriter" plugin but that sounds like a bad idea.
> 
> Any other ideas?