1

Say I have the following field in a doc:

<str name="groupId">1000 1001 1002</str>

I want to be able to pass in a list of groupIds that the user is in as a filter query and only pull out the docs where the groupIds the user owns are all matched in the doc - if there is a groupid in the doc that the user is not in then the doc is not returned. If there is a groupId in the query that is not in the doc then that is ignored - the user can belong to more groups than the doc does. But the user must be in all of the groupIds that the doc has specified otherwise they do not have permission to view it.

Is this possible?

[UPDATE]

I have now added my multiValue field which looks like this:

<arr name="groupId">
    <str>1000</str>
    <str>1001</str>
    <str>1002</str>
</arr>

How can I ensure that a user with user groups 1000, 1001, 1002, 1003 gets that doc but user with groups 1000, 1002, 1003 does not as they are missing group 1001?

1 Answers1

0

Yes you can do this. I would recommend storing these groupId values within a multiValued field in your schema. Please see the following for some good guidance on using multiValued fields

Once you have these stored in a multiValued field, you can issue a filter query as you stated to only return documents where all of the specified groupIds are associated.

Community
  • 1
  • 1
Paige Cook
  • 22,415
  • 3
  • 57
  • 68
  • 1
    I now have my groupId as a multiValue field. How do I make is so the ids stored are _all_ matched? –  Oct 08 '13 at 13:59