AnsweredAssumed Answered

Lucene query Association.

Question asked by joksy on Aug 20, 2009
Latest reply on Aug 23, 2009 by pmonks
Hi Guys,
This question is about the lucene query syntax, for getting the association. so imagine a situation like this one.
var documentQuery = search.luceneSearch("+(TYPE:\"rsi:documentGuest\") PATH:\"/app:company_home//*\"");
This query return to me an array of documentGuest belong to the company home.
The documentGuest type has one association call rsi:assigned. to another type :rsi:documentAssigned
My ideal goal is to modify this query to search also for the name of  target name of the association.

Until now the only way is to loop for all resultSet like :

function getMyDocument(documentGuest,target,guestName){
   var docArray = new Array();
   var internalIndex = 0;
   for (var i = 0; i < documentGuest.length; i++){
            if(documentGuest[i].assocs[target] != null){
            var assocstarget = documentGuest[i].assocs[target];
            for(var x = 0;x < assocstarget.length;x++){
               if(assocstarget[x] == guestName){
                  docArray[internalIndex] = documentGuest[i];
   return docArray;

But it is clearly the worste scenario in terms of performance. I really appreciate if someone can help me.
I ve try to red the documentation but without success.

In the end if with lucene could be impossible do that maybe using xpath a solution can exist.

Thanks a lot guys