03-23-2011 12:18 PM
function getUsername(firstName, lastName) {
logger.log("getUsername, entrato");
var users = search.luceneSearch("+@cm\\:firstName:\"" + firstName + "\" +@cm\\:lastName:\"" + lastName + "\"");
for ( var i = 0; i < users.length; i++) {
logger.log("getUsername, utente "+i+" = "+users.userName);
}
logger.log("getUsername, uscito");
}
getUsername("firstName", "lastName");
It returns nothing, but if I change the query with "TEXT:alfresco" it returns some result.04-04-2011 02:15 AM
04-12-2011 08:37 AM
04-18-2011 06:47 AM
+@cm\:firstName:firstNam* +@cm\:lastName:lastName*
It works, but for example if I must to search "Valentina Rossi", so use this query:+@cm\:firstName:valentin* +@cm\:lastName:ross*
it can be return the user "Valentino Rosso" (or others combinations) and this is not perfect.function getUsername(firstName, lastName) {
logger.log("getUsername, entrato");
var userName = null;
var firstNameToSearch = firstName.substring(0,firstName.length-1).concat("*").toLowerCase();
var lastNameToSearch = lastName.substring(0,lastName.length-1).concat("*").toLowerCase();
var luceneQuery = "+@cm\\:firstName:" + firstNameToSearch + " +@cm\\:lastName:" + lastNameToSearch;
logger.log("getUsername, eseguo la query ["+luceneQuery+"]");
var users = search.luceneSearch(luceneQuery);
if (users.length > 0) {
var userName = users[0].properties["cm:userName"];
logger.log("getUsername, utente " + firstName + "," + lastName + " = " + userName);
} else {
logger.log("getUsername, nessun utente " + firstName + "," + lastName + " trovato");
}
logger.log("getUsername, uscito");
return userName;
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.