user field(uf) not working with Post filter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

user field(uf) not working with Post filter

shruti suri
Hi,

I am using a custom handler with edismax parser. I am using uf parameter in
the handler to restrict some fields from search.  But uf is not working with
post filter(fq). I want to restricted same fields in fq, so that people
could not filter on some fields. Please suggest how can I do that.

        <requestHandler name="custom" class="solr.SearchHandler">
                <lst name="defaults">
                        <str name="echoParams">explicit</str>
                        <float name="tie">1</float>
                        <int name="rows">10</int>
                        <str name="defType">edismax</str>
                        <str name="qf">name title author key</str>
                        <str name="q.alt">*:*</str>
                        <str name="fl">*</str>
                </lst>
                <lst name="invariants">
                        <str name="wt">apix</str>
                        <str name="uf">* -author -key</str>
                </lst>
        </requestHandler>



-----
Regards
Shruti
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Regards
Shruti
Reply | Threaded
Open this post in threaded view
|

Re: user field(uf) not working with Post filter

Zheng Lin Edwin Yeo
Hi Shruti,

Which version of Solr are you using?
Maybe you can take a look at the below guide first if you haven't done so:
https://lucene.apache.org/solr/guide/7_4/common-query-parameters.html#fq-filter-query-parameter

Regards,
Edwin

On Wed, 5 Sep 2018 at 21:17, shruti suri <[hidden email]> wrote:

> Hi,
>
> I am using a custom handler with edismax parser. I am using uf parameter in
> the handler to restrict some fields from search.  But uf is not working
> with
> post filter(fq). I want to restricted same fields in fq, so that people
> could not filter on some fields. Please suggest how can I do that.
>
>         <requestHandler name="custom" class="solr.SearchHandler">
>                 <lst name="defaults">
>                         <str name="echoParams">explicit</str>
>                         <float name="tie">1</float>
>                         <int name="rows">10</int>
>                         <str name="defType">edismax</str>
>                         <str name="qf">name title author key</str>
>                         <str name="q.alt">*:*</str>
>                         <str name="fl">*</str>
>                 </lst>
>                 <lst name="invariants">
>                         <str name="wt">apix</str>
>                         <str name="uf">* -author -key</str>
>                 </lst>
>         </requestHandler>
>
>
>
> -----
> Regards
> Shruti
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>
Reply | Threaded
Open this post in threaded view
|

Re: user field(uf) not working with Post filter

shruti suri
Hi Zheng,

I am using version 6.1.0. Basically, I want few fields to be blocked in fq.

Thanks



-----
Regards
Shruti
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Regards
Shruti
Reply | Threaded
Open this post in threaded view
|

Re: user field(uf) not working with Post filter

Shawn Heisey-2
In reply to this post by shruti suri
On 9/5/2018 7:17 AM, shruti suri wrote:
> I am using a custom handler with edismax parser. I am using uf parameter in
> the handler to restrict some fields from search.  But uf is not working with
> post filter(fq). I want to restricted same fields in fq, so that people
> could not filter on some fields. Please suggest how can I do that.

What is the fq value?  This has not been shared.

Unless you explicitly request a parser *IN THE FQ PARAMETER VALUE*, the
filter will use the Lucene parser.  And it will not be a postfilter if
it is using lucene, dismax, edismax or certain other parsers -- those
parsers do not implement PostFilter.  The lucene parser does not support
the uf parameter.

I would say that it is not normal practice to put user input into fq
without modification.  That should go into q, and there should probably
be some kind of validation in your code on user input before it gets to
Solr to look for possible problems.

Adding {!edismax} to the start of the fq value *might* make it honor the
uf parameter, but I have not tried this.

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: user field(uf) not working with Post filter

shruti suri
Hi Shawn,

Passing "{!edismax}" with fq solves my requirements and now by passing
parser with fq, uf parameter is working.

Thanks
Shruti suri



-----
Regards
Shruti
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Regards
Shruti