<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello Rodrigo,</p>
    <p>this is a known issue, and the one that is not easily resolvable.
      (It is recorded in JIRA, maybe in various contexts, like <a
        href="https://jira.evolveum.com/browse/MID-3293">MID-3293</a>).</p>
    <p>I'm afraid we will not be able to fix this in 3.6.</p>
    <p>A partial relief could be using the "exists" clause, i.e.</p>
    <p><tt><query></tt><tt><br>
      </tt><tt>    <filter></tt><tt><br>
      </tt><tt>        <exists></tt><tt><br>
      </tt><tt>            <path>assignment</path></tt><tt><br>
      </tt><tt>            <filter></tt><tt><br>
      </tt><tt>                <or></tt><tt><br>
      </tt><tt>                    <ref></tt><tt><br>
      </tt><tt>                       
        <path>targetRef</path></tt><tt><br>
      </tt><tt>                        <value
        oid="00000000-0000-0000-0000-000000000004"/></tt><tt><br>
      </tt><tt>                    </ref></tt><tt><br>
      </tt><tt>                    <ref></tt><tt><br>
      </tt><tt>                       
        <path>targetRef</path></tt><tt><br>
      </tt><tt>                        <value
        oid="00000000-0000-0000-0000-000000000008"/></tt><tt><br>
      </tt><tt>                    </ref></tt><tt><br>
      </tt><tt>                </or></tt><tt><br>
      </tt><tt>            </filter></tt><tt><br>
      </tt><tt>        </exists></tt><tt><br>
      </tt><tt>    </filter></tt><tt><br>
      </tt><tt></query></tt></p>
    <p>But it still returns two results if the user has both
      assignments.</p>
    <p>In midPoint, we do a manual "deduplication" of results at various
      places. Also, there's an experimental "distinct" option in our
      repository API, since 3.6. (But currently it is not available from
      the outside.)</p>
    <p>In what context do you have this problem? Is it in bulk actions?
      Or some other task?<br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 29.03.2017 23:07, Rodrigo Yanis
      wrote:<br>
    </div>
    <blockquote
cite="mid:CADu-59G7U3X95kHLF+wFdTp0RTX_fDtf6VYBZiNx6TQuQa_6BA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello everyone,
        <div><br>
        </div>
        <div>We've been reproducing an issue with midpoint's
          querying/filtering of objects where, upon executing a query
          like the following, and expecting only one result for it, we
          get that result but multiple times.</div>
        <div><br>
        </div>
        <div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex"><font size="1"><query><br>
                  <filter><br>
                      <or><br>
                          <ref><br>
                             
              <path>assignment/targetRef</path><br>
                              <value
              oid="00000000-0000-1de4-0004-000000000006"/><br>
                          </ref><br>
                          <ref><br>
                             
              <path>assignment/targetRef</path><br>
                              <value
              oid="00000000-0000-1de4-0004-000000000061"/><br>
                          </ref><br>
                      </or><br>
                  </filter><br>
              </query></font></blockquote>
          <div><br>
          </div>
          <div>So in this case only one object satisfies that condition,
            yet the output is the following:</div>
          <div><br>
          </div>
          <div><img src="cid:part2.34BB8EA3.9779C4C8@evolveum.com"
              alt="Imagen integrada 1" height="101" width="410"> </div>
        </div>
        <div><br>
        </div>
        <div>At first we thought this might have been a view issue, but
          then we tested it on a custom task's filter, and the result
          was that the same user was processed 3 times (or more in other
          examples), making this type of queries a no-go for
          performance-intensive processes. </div>
        <div><br>
        </div>
        <div>Is this the right way to approach a query like this? Or
          perhaps there's already a JIRA ticket for this...</div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>
          <div>
            <div class="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr"><br>
                              </div>
                              <div dir="ltr"><font face="arial,
                                  helvetica, sans-serif"><b>Rodrigo
                                    Yanis.</b><br>
                                  <img moz-do-not-send="true"
                                    src="http://www.identicum.com/img/favicon.ico">Identicum
                                  S.A.<br>
                                </font>Jorge Newbery 3226<br>
                                Tel: +54 (11) 4824-9971<font
                                  face="arial, helvetica, sans-serif"><br>
                                  <a moz-do-not-send="true"
                                    href="mailto:ryanis@identicum.com"
                                    target="_blank"><font
                                      color="#0b5394">ryanis@identicum.com</font></a><br>
                                  <a moz-do-not-send="true"
                                    href="http://www.identicum.com/"
                                    target="_blank"><font
                                      color="#0b5394">www.identicum.com</font></a></font></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>