Yes it is a bit of a kludge but will work around the issue. I would think that (field Contains @UserName) would be a pretty standard search. I'd tend to call it a bug rather than an undocumented enhancement! :-) But a generalized case would require that I parse out the CN. OU, and O into separate variable then formulate the query. Because not every organization uses the OU, you would need to check if it is blank otherwise the field CONTAINS "" would fail. Just looks like a ton of extra effort for no reasonable gain. And that does not cover the several hours I've spent so far just to find out it was not my code, but what I would call a bug because if you enter the query MyField CONTAINS @UserName into the Notes FTIndex Query it returns the correct search results.
Further investigation and actually your work around will not work as a generalized case. If the field that you are querying is a multivalue fields and it contains several names from different OU's you have no way of knowing if the CN/OU/O that it finds all relate to the same individual. I believe that the FTIndex lookup in SSJS is flawed and does not work in several different instances. I have found another instance wher I can not get the SSJS Search code does not work. I have a field in a document that may contain one or more roles, and I want to select documents where a user holds a role that is contained in the field, of course the user might possess more that one role as well. If I put the following in the Search property :
var userRoles:Array = session.evaluate("@UserRoles");
qString = "(FIELD ACCurentApprovers = \"" + userRoles +"\")";
sessionScope.queryString = qString;
return qString;
I have no idea how to reasonably be able to documents when using the full distinguished name or a role. Really frustrating, hours of trial and error - mostly error.
(FIELD ACCurentApprovers = "[ACAdmin]"),(FIELD ACCurentApprovers = "[Marketing]")
it makes no difference if I use CONTAINS or EQUALS
It sure looks to me like the Search parses the
The actual