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 Eugene Prystupa <ep...@lab49.com> on 2011/09/09 15:56:12 UTC
Adding Query Filter custom implementation to Solr's pipeline
Hi,
When I was using Lucene directly I used a custom implementation of query filter to enforce entitlements of search results. Now, that I'm switching my infrastructure from custom host to Solr, what is the best way to configure Solr to use my custom query filter for every request?
Thanks!
-Eugene
________________________________
This email and any attachments may contain information which is confidential and/or privileged. The information is intended exclusively for the addressee and the views expressed may not be official policy, but the personal views of the originator. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents is prohibited. If you have received this email and any file transmitted with it in error, please notify the sender by telephone or return email immediately and delete the material from your computer. Internet communications are not secure and Lab49 is not responsible for their abuse by third parties, nor for any alteration or corruption in transmission, nor for any damage or loss caused by any virus or other defect. Lab49 accepts no liability or responsibility arising out of or in any way connected to this email.
Re: Adding Query Filter custom implementation to Solr's pipeline
Posted by Chris Hostetter <ho...@fucit.org>.
: If you do need to implement something truely custom, writing it as your
: own QParser to trigger via an "fq" can be advantageous so it can cached
: and re-used by many queries.
I forgot to mention a very cool new feature that is about to be released
in Solr 3.4
You can now instruct Solr that an "fq" filter query should not be cached,
in which case Solr will only consult it after executing the main query --
which can be handy if you have some filtering logic that is very expensive
to compute for each document, and you only wnat to evaluate for documents
that have already been matched by the main query and all other filter
queries.
Details are on the wiki...
https://wiki.apache.org/solr/CommonQueryParameters#Caching_of_filters
-Hoss
Re: Adding Query Filter custom implementation to Solr's pipeline
Posted by Chris Hostetter <ho...@fucit.org>.
: When I was using Lucene directly I used a custom implementation of query
: filter to enforce entitlements of search results. Now, that I'm
: switching my infrastructure from custom host to Solr, what is the best
: way to configure Solr to use my custom query filter for every request?
It depends on how complex your custom Filter was.
many people find that things that when using Solr, they can reimplement
basic Filter logic using "fq" params and the built in QParsers provided by
solr.
If you do need to implement something truely custom, writing it as your
own QParser to trigger via an "fq" can be advantageous so it can cached
and re-used by many queries.
If that doesn't cut it for you, some people implement their own
SearchComponents to manipulate the Queries.
And as a last resort: you can always implement your own RequestHandler and
directly use so SolrIndexSearcher to execute the queyr anyway you want --
but if you don't use the DocList/DocSet methods, other built in features
like faceting won't be very easy to use.
If you provide some more details on how your existing Filter work,s people
cna provide more advice on what would make the most sense.
-Hoss