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 Jo...@blum.com on 2012/08/28 15:28:12 UTC

refiltering search results

Hello,

Im trying to develop a search component to filter the search results agein 
with current data so that the user only sess results he is permitted to 
see.

Can someone give me a hint where to start and how to do this? Is a Search 
Component the right place to do this?

Regards
Johannes

Re: Re: Antwort: Re: refiltering search results

Posted by Erick Erickson <er...@gmail.com>.
Perhaps you're making this harder than it needs to be.

The preferred way of handling ACL calculations is by group. That is,
you just have a multiValued field in each document that contains the
groups have permissions for that document, say G1, G2, G3. Then you
just add an fq clause for the query that contains the groups the user
belongs to, as &fq=acl:(G1 G2 G3). this woks well when you have, say,
< 100 groups (or authorization tokens) and know them at index time.

The other thing you can consider is a PostFilter, here's the JIRA:
https://issues.apache.org/jira/browse/SOLR-2429

The third option is to use a custom Function, see
http://wiki.apache.org/solr/FunctionQuery
The trick here is that you can use the contents of fields (really, numeric
data works best) to compute a value that is multiplied into the score. If
you return 0 when the user isn't permitted access, the score becomes 0
and the document isn't returned.

the thing you have to be careful of is that accessing the contents of fields
for each document in a search can be very, very costly.

Best
Erick


On Wed, Aug 29, 2012 at 7:28 AM,  <Jo...@blum.com> wrote:
> Von:
> Ahmet Arslan <io...@yahoo.com>
> An:
> solr-user@lucene.apache.org
> Datum:
> 29.08.2012 10:50
> Betreff:
> Re: Antwort: Re: refiltering search results
>
>
> Thanks for the answer.
>
> My next question is how can i filter the result or how to replace the old
> ResponseBuilder Result with a new one?
>
>
> --- On Wed, 8/29/12, Johannes.Schwendinger@blum.com
> <Jo...@blum.com> wrote:
>
>> From: Johannes.Schwendinger@blum.com <Jo...@blum.com>
>> Subject: Antwort: Re: refiltering search results
>> To: solr-user@lucene.apache.org
>> Date: Wednesday, August 29, 2012, 8:22 AM
>> The main idea is to filter results as
>> much as possible with solr an then
>> check this result again.
>> To do this I have to read some information from some fields
>> of the
>> documents in the result.
>> At the moment I am trying to do this in the process method
>> of a Search
>> Component. But I even dont know
>> how to get access to the search results or the index Fields
>> of the
>> documents.
>> I have thought of ResponseBuilder.getResults() but after I
>> have the
>> DocListandSet Object I get stuck.
>
>
> You can read information from some fields using DocListandSet with
>
> org.apache.solr.util.SolrPluginUtils#docListToSolrDocumentList
>
> method.
>

Antwort: Re: Antwort: Re: refiltering search results

Posted by Jo...@blum.com.
Von:
Ahmet Arslan <io...@yahoo.com>
An:
solr-user@lucene.apache.org
Datum:
29.08.2012 10:50
Betreff:
Re: Antwort: Re: refiltering search results


Thanks for the answer. 

My next question is how can i filter the result or how to replace the old 
ResponseBuilder Result with a new one?


--- On Wed, 8/29/12, Johannes.Schwendinger@blum.com 
<Jo...@blum.com> wrote:

> From: Johannes.Schwendinger@blum.com <Jo...@blum.com>
> Subject: Antwort: Re: refiltering search results
> To: solr-user@lucene.apache.org
> Date: Wednesday, August 29, 2012, 8:22 AM
> The main idea is to filter results as
> much as possible with solr an then 
> check this result again. 
> To do this I have to read some information from some fields
> of the 
> documents in the result. 
> At the moment I am trying to do this in the process method
> of a Search 
> Component. But I even dont know 
> how to get access to the search results or the index Fields
> of the 
> documents. 
> I have thought of ResponseBuilder.getResults() but after I
> have the 
> DocListandSet Object I get stuck. 


You can read information from some fields using DocListandSet with

org.apache.solr.util.SolrPluginUtils#docListToSolrDocumentList

method.


Re: Antwort: Re: refiltering search results

Posted by Ahmet Arslan <io...@yahoo.com>.

--- On Wed, 8/29/12, Johannes.Schwendinger@blum.com <Jo...@blum.com> wrote:

> From: Johannes.Schwendinger@blum.com <Jo...@blum.com>
> Subject: Antwort: Re: refiltering search results
> To: solr-user@lucene.apache.org
> Date: Wednesday, August 29, 2012, 8:22 AM
> The main idea is to filter results as
> much as possible with solr an then 
> check this result again. 
> To do this I have to read some information from some fields
> of the 
> documents in the result. 
> At the moment I am trying to do this in the process method
> of a Search 
> Component. But I even dont know 
> how to get access to the search results or the index Fields
> of the 
> documents. 
> I have thought of ResponseBuilder.getResults() but after I
> have the 
> DocListandSet Object I get stuck. 


You can read information from some fields using DocListandSet with

org.apache.solr.util.SolrPluginUtils#docListToSolrDocumentList

method.

Antwort: Re: refiltering search results

Posted by Jo...@blum.com.
The main idea is to filter results as much as possible with solr an then 
check this result again. 
To do this I have to read some information from some fields of the 
documents in the result. 
At the moment I am trying to do this in the process method of a Search 
Component. But I even dont know 
how to get access to the search results or the index Fields of the 
documents. 
I have thought of ResponseBuilder.getResults() but after I have the 
DocListandSet Object I get stuck. 

I know the time of the search will increase but security has priority

Regards,
Johannes



Von:
Alexandre Rafalovitch <ar...@gmail.com>
An:
solr-user@lucene.apache.org
Datum:
28.08.2012 16:48
Betreff:
Re: refiltering search results



I think there was a JOIN example (for version 4) somewhere with the
permission restrictions. Or, if you have very broad categories, you
can use different search handlers with restriction queries baked in.

These might be enough. Otherwise, you have to send the list of IDs
back and forth and it could be expensive.

Regards,
   Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Tue, Aug 28, 2012 at 9:28 AM,  <Jo...@blum.com> wrote:
> Hello,
>
> Im trying to develop a search component to filter the search results 
agein
> with current data so that the user only sess results he is permitted to
> see.
>
> Can someone give me a hint where to start and how to do this? Is a 
Search
> Component the right place to do this?
>
> Regards
> Johannes


Re: refiltering search results

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
I think there was a JOIN example (for version 4) somewhere with the
permission restrictions. Or, if you have very broad categories, you
can use different search handlers with restriction queries baked in.

These might be enough. Otherwise, you have to send the list of IDs
back and forth and it could be expensive.

Regards,
   Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Tue, Aug 28, 2012 at 9:28 AM,  <Jo...@blum.com> wrote:
> Hello,
>
> Im trying to develop a search component to filter the search results agein
> with current data so that the user only sess results he is permitted to
> see.
>
> Can someone give me a hint where to start and how to do this? Is a Search
> Component the right place to do this?
>
> Regards
> Johannes

Re: refiltering search results

Posted by Ahmet Arslan <io...@yahoo.com>.
> Im trying to develop a search component to filter the search
> results agein 
> with current data so that the user only sess results he is
> permitted to 
> see.
> 
> Can someone give me a hint where to start and how to do
> this? Is a Search 
> Component the right place to do this?

May you can inspire from : 

https://svn.apache.org/repos/asf/manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java

There is a QParser version too.