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 Thomas Seidl <re...@gmx.net> on 2013/12/01 21:46:23 UTC

What type of Solr plugin do I need for filtering results?

Hi,

I'm currently looking at writing my first Solr plugin, but I could not 
really find any "overview" information about how a Solr request works 
internally, what the control flow is and what kind of plugins are 
available to customize this at which point. The Solr wiki page on 
plugins [1], in my opinion, already assumes too much knowledge and is 
too terse in its descriptions.

[1] http://wiki.apache.org/solr/SolrPlugins

If anyone knows of any good ressources to get me started, that would be 
awesome!

However, also pretty helpful would be just to know what kind of plugin I 
should create for my use case, as I could then at least try to find 
information specific to that. What I want to do is filter the search 
results (at the time fq filters are applied, so before sorting, 
facetting, range selection, etc. takes place) by some custom criterion 
(passed in the URL). The plan is to add the data needed for that custom 
filter as a separate set of documents to Solr and look them up from the 
Solr index when filtering the query. Basically the thing discussed in 
[2], at 29:07.

[2] http://www.youtube.com/watch?v=kJa-3PEc90g&feature=youtu.be&t=29m7s

So, the question is, what kind of plugin would I use (and how would it 
have to be configured)? I first thought it'd have to be a 
SearchComponent, but I think with that I'd only get the results after 
they are sorted and trimmed to the range, right?

Thanks a lot in advance,
Thomas Seidl

Re: What type of Solr plugin do I need for filtering results?

Posted by Thomas Seidl <re...@gmx.net>.
Thanks a lot for both of your answers! The QParserPlugin is probably 
what I meant, but join queries also look interesting and like the could 
maybe solve my use case, too, without any custom code.
However, since this would make it impossible (I think) to have a score 
for the results but I do want to do fulltext searches on the returned 
field set (with score) it will probably not be enough.

Anyways, I'll look into both of your suggestions. Thanks a lot again!

On 2013-12-02 05:39, Ahmet Arslan wrote:
> It depends on your use case. What is you custom criteria how is stored etc.
>
>
> For example  I had two tables, lets say items and permissions tables. Permissions table was holding itemId,userId pairs. Meaning userId can see this itemId. My initial effort was index items and add a multivalued field named WhoCanSeeMe. And fiterQuery on that field using current user.
>
> After sometime indexing become troublesome. Indexing was slowing down. I switched to two cores for each table and used query time join. (JoinQParser) as a fq. I didnt have anly plugin for the above.
>
> By the way here is an example of post filter Joel advises : http://searchhub.org/2012/02/22/custom-security-filtering-in-solr/
>
>
>
>
>
>
> On Monday, December 2, 2013 5:14 AM, Joel Bernstein <jo...@gmail.com> wrote:
>
> What you're looking for is a QParserPlugin. Here is an example:
>
> http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_4_6_0/solr/core/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java?revision=1544545&view=markup
>
> You're probably want to implement the QParserPlugin as PostFilter.
>
>
>
>
> On Sun, Dec 1, 2013 at 3:46 PM, Thomas Seidl <re...@gmx.net> wrote:
>
>> Hi,
>>
>> I'm currently looking at writing my first Solr plugin, but I could not
>> really find any "overview" information about how a Solr request works
>> internally, what the control flow is and what kind of plugins are available
>> to customize this at which point. The Solr wiki page on plugins [1], in my
>> opinion, already assumes too much knowledge and is too terse in its
>> descriptions.
>>
>> [1] http://wiki.apache.org/solr/SolrPlugins
>>
>> If anyone knows of any good ressources to get me started, that would be
>> awesome!
>>
>> However, also pretty helpful would be just to know what kind of plugin I
>> should create for my use case, as I could then at least try to find
>> information specific to that. What I want to do is filter the search
>> results (at the time fq filters are applied, so before sorting, facetting,
>> range selection, etc. takes place) by some custom criterion (passed in the
>> URL). The plan is to add the data needed for that custom filter as a
>> separate set of documents to Solr and look them up from the Solr index when
>> filtering the query. Basically the thing discussed in [2], at 29:07.
>>
>> [2] http://www.youtube.com/watch?v=kJa-3PEc90g&feature=youtu.be&t=29m7s
>>
>> So, the question is, what kind of plugin would I use (and how would it
>> have to be configured)? I first thought it'd have to be a SearchComponent,
>> but I think with that I'd only get the results after they are sorted and
>> trimmed to the range, right?
>>
>> Thanks a lot in advance,
>> Thomas Seidl
>>
>
>
>

Re: What type of Solr plugin do I need for filtering results?

Posted by Ahmet Arslan <io...@yahoo.com>.
It depends on your use case. What is you custom criteria how is stored etc.


For example  I had two tables, lets say items and permissions tables. Permissions table was holding itemId,userId pairs. Meaning userId can see this itemId. My initial effort was index items and add a multivalued field named WhoCanSeeMe. And fiterQuery on that field using current user.

After sometime indexing become troublesome. Indexing was slowing down. I switched to two cores for each table and used query time join. (JoinQParser) as a fq. I didnt have anly plugin for the above.

By the way here is an example of post filter Joel advises : http://searchhub.org/2012/02/22/custom-security-filtering-in-solr/






On Monday, December 2, 2013 5:14 AM, Joel Bernstein <jo...@gmail.com> wrote:
 
What you're looking for is a QParserPlugin. Here is an example:

http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_4_6_0/solr/core/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java?revision=1544545&view=markup

You're probably want to implement the QParserPlugin as PostFilter.




On Sun, Dec 1, 2013 at 3:46 PM, Thomas Seidl <re...@gmx.net> wrote:

> Hi,
>
> I'm currently looking at writing my first Solr plugin, but I could not
> really find any "overview" information about how a Solr request works
> internally, what the control flow is and what kind of plugins are available
> to customize this at which point. The Solr wiki page on plugins [1], in my
> opinion, already assumes too much knowledge and is too terse in its
> descriptions.
>
> [1] http://wiki.apache.org/solr/SolrPlugins
>
> If anyone knows of any good ressources to get me started, that would be
> awesome!
>
> However, also pretty helpful would be just to know what kind of plugin I
> should create for my use case, as I could then at least try to find
> information specific to that. What I want to do is filter the search
> results (at the time fq filters are applied, so before sorting, facetting,
> range selection, etc. takes place) by some custom criterion (passed in the
> URL). The plan is to add the data needed for that custom filter as a
> separate set of documents to Solr and look them up from the Solr index when
> filtering the query. Basically the thing discussed in [2], at 29:07.
>
> [2] http://www.youtube.com/watch?v=kJa-3PEc90g&feature=youtu.be&t=29m7s
>
> So, the question is, what kind of plugin would I use (and how would it
> have to be configured)? I first thought it'd have to be a SearchComponent,
> but I think with that I'd only get the results after they are sorted and
> trimmed to the range, right?
>
> Thanks a lot in advance,
> Thomas Seidl
>



-- 
Joel Bernstein
Search Engineer at Heliosearch

Re: What type of Solr plugin do I need for filtering results?

Posted by Joel Bernstein <jo...@gmail.com>.
What you're looking for is a QParserPlugin. Here is an example:

http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_4_6_0/solr/core/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java?revision=1544545&view=markup

You're probably want to implement the QParserPlugin as PostFilter.



On Sun, Dec 1, 2013 at 3:46 PM, Thomas Seidl <re...@gmx.net> wrote:

> Hi,
>
> I'm currently looking at writing my first Solr plugin, but I could not
> really find any "overview" information about how a Solr request works
> internally, what the control flow is and what kind of plugins are available
> to customize this at which point. The Solr wiki page on plugins [1], in my
> opinion, already assumes too much knowledge and is too terse in its
> descriptions.
>
> [1] http://wiki.apache.org/solr/SolrPlugins
>
> If anyone knows of any good ressources to get me started, that would be
> awesome!
>
> However, also pretty helpful would be just to know what kind of plugin I
> should create for my use case, as I could then at least try to find
> information specific to that. What I want to do is filter the search
> results (at the time fq filters are applied, so before sorting, facetting,
> range selection, etc. takes place) by some custom criterion (passed in the
> URL). The plan is to add the data needed for that custom filter as a
> separate set of documents to Solr and look them up from the Solr index when
> filtering the query. Basically the thing discussed in [2], at 29:07.
>
> [2] http://www.youtube.com/watch?v=kJa-3PEc90g&feature=youtu.be&t=29m7s
>
> So, the question is, what kind of plugin would I use (and how would it
> have to be configured)? I first thought it'd have to be a SearchComponent,
> but I think with that I'd only get the results after they are sorted and
> trimmed to the range, right?
>
> Thanks a lot in advance,
> Thomas Seidl
>



-- 
Joel Bernstein
Search Engineer at Heliosearch