Filter out objects with specific IDs


(Christopher Grebs) #1

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a script
filter.

All my documents have a forum_pk field with the ID and I collect all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this: https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(Christopher Grebs) #2

Okay, sorry everyone... I was dumb enough to forget the proper
mapping. Now it works fine.

Sorry!

Regards,
Christopher.

On Aug 14, 10:25 pm, Christopher Grebs cgr...@googlemail.com wrote:

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a script
filter.

All my documents have a forum_pk field with the ID and I collect all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this:https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(Shay Banon) #3

I suggest using terms filter for this, and not script, it will be faster and
cacheable.

On Mon, Aug 15, 2011 at 12:04 AM, Christopher Grebs
cgrebs@googlemail.comwrote:

Okay, sorry everyone... I was dumb enough to forget the proper
mapping. Now it works fine.

Sorry!

Regards,
Christopher.

On Aug 14, 10:25 pm, Christopher Grebs cgr...@googlemail.com wrote:

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a script
filter.

All my documents have a forum_pk field with the ID and I collect all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this:https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(Christopher Grebs) #4

Hey,

this is great this is indeed mus simpler and faster. Thanks! Now I
just need to find out a way to filter out items with a index specific
terms filter if I search over more indices, do you have any suggestion
on this? Combining them with and or or does not seem to work
properly.

Regards,
Christopher.

On Mon, Aug 15, 2011 at 12:46 AM, Shay Banon kimchy@gmail.com wrote:

I suggest using terms filter for this, and not script, it will be faster and
cacheable.

On Mon, Aug 15, 2011 at 12:04 AM, Christopher Grebs cgrebs@googlemail.com
wrote:

Okay, sorry everyone... I was dumb enough to forget the proper
mapping. Now it works fine.

Sorry!

Regards,
Christopher.

On Aug 14, 10:25 pm, Christopher Grebs cgr...@googlemail.com wrote:

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a script
filter.

All my documents have a forum_pk field with the ID and I collect all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this:https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(Shay Banon) #5

Do you mean there are different fields you need to filter on between
indices? An or filter should work.

On Mon, Aug 15, 2011 at 7:44 AM, Christopher Grebs cgrebs@googlemail.comwrote:

Hey,

this is great this is indeed mus simpler and faster. Thanks! Now I
just need to find out a way to filter out items with a index specific
terms filter if I search over more indices, do you have any suggestion
on this? Combining them with and or or does not seem to work
properly.

Regards,
Christopher.

On Mon, Aug 15, 2011 at 12:46 AM, Shay Banon kimchy@gmail.com wrote:

I suggest using terms filter for this, and not script, it will be faster
and
cacheable.

On Mon, Aug 15, 2011 at 12:04 AM, Christopher Grebs <
cgrebs@googlemail.com>
wrote:

Okay, sorry everyone... I was dumb enough to forget the proper
mapping. Now it works fine.

Sorry!

Regards,
Christopher.

On Aug 14, 10:25 pm, Christopher Grebs cgr...@googlemail.com wrote:

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a script
filter.

All my documents have a forum_pk field with the ID and I collect all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this:https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(Christopher Grebs) #6

Hey Shay,

yea, I just played along with various filters and just stumbled upon
the type filter and this seems to be the one I was looking for. At
least the results now look as I want them to be, with index specific
acl checks.

Thanks so much!

Regards,
Christopher.

On Mon, Aug 15, 2011 at 1:00 PM, Shay Banon kimchy@gmail.com wrote:

Do you mean there are different fields you need to filter on between
indices? An or filter should work.

On Mon, Aug 15, 2011 at 7:44 AM, Christopher Grebs cgrebs@googlemail.com
wrote:

Hey,

this is great this is indeed mus simpler and faster. Thanks! Now I
just need to find out a way to filter out items with a index specific
terms filter if I search over more indices, do you have any suggestion
on this? Combining them with and or or does not seem to work
properly.

Regards,
Christopher.

On Mon, Aug 15, 2011 at 12:46 AM, Shay Banon kimchy@gmail.com wrote:

I suggest using terms filter for this, and not script, it will be faster
and
cacheable.

On Mon, Aug 15, 2011 at 12:04 AM, Christopher Grebs
cgrebs@googlemail.com
wrote:

Okay, sorry everyone... I was dumb enough to forget the proper
mapping. Now it works fine.

Sorry!

Regards,
Christopher.

On Aug 14, 10:25 pm, Christopher Grebs cgr...@googlemail.com wrote:

Hey there everyone!

I am trying to implement some ACL filter into my search queries and
the simplest way to do that seems to be a filtered query with a
script
filter.

All my documents have a forum_pk field with the ID and I collect
all
forum ids a user has access to. To filter out forums a user does not
has access to I came up with this:https://gist.github.com/1145266

The problem is that this now filters all documents and none is
returned, but there are documents with a forum_pk different then the
missing 8. In this query only forums with ID 8 should be filtered
out.

I use the mvel scripting interface, but also tried python with no
success.

What am I doing wrong?


(system) #7