jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfr <ere...@gmail.com>
Subject Query with left outer join on reference properties
Date Mon, 11 Jun 2012 11:57:12 GMT
Hi all!

I'm trying to construct a QOM query based on 3 selectors. Here is an
abstract of my code:

<code>

			QueryObjectModelFactory factory =
session.getWorkspace().getQueryManager().getQOMFactory();
			ValueFactory vf = session.getValueFactory();
			
			
			Source selDossier = factory.selector("x:dossier", "dossier");
			Source selEtat     = factory.selector("x:dictionnaryEntry", "etatDossier");
			Source selClasse     = factory.selector("x:dictionnaryEntry",
"classeDossier");
			
			//JoinCondition dossierClasse =
factory.equiJoinCondition("dossier", "x:classe", "classeDossier",
"jcr:uuid");
			//JoinCondition dossierEtat   =
factory.equiJoinCondition("dossier", "x:etat", "etatDossier",
"jcr:uuid");
			JoinCondition dossierClasse =
factory.equiJoinCondition("classeDossier", "jcr:uuid", "dossier",
"x:classe");
			JoinCondition dossierEtat   =
factory.equiJoinCondition("etatDossier", "jcr:uuid","dossier",
"x:etat");
			
			Join classeJoin = factory.join(selDossier, selClasse,
QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, dossierClasse);
			Join finalJoin = factory.join(classeJoin, selEtat,
QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, dossierEtat);
			
			Literal queryLiteral = factory.literal(vf.createValue(queryString));
			
			Constraint dossier = factory.fullTextSearch("dossier", null, queryLiteral);
			Constraint etat    = factory.fullTextSearch("etatDossier", null,
queryLiteral);
			Constraint classe    = factory.fullTextSearch("classeDossier",
null, queryLiteral);
			
			Constraint or = factory.or(dossier, classe);
			or = factory.or(or, etat);
			
			Column selectColumn = factory.column("dossier", "jcr:uuid", "uuid");
			
			QueryObjectModel qm = factory.createQuery(finalJoin, or, null, null);
			
			QueryResult qr = qm.execute();
</code>

My problem is that if the "x:classe" and "x:etat" properties are not
set on "x:dossier" nodes, the query return no nodes. I expected that
the left outer join would take care of this issue and return
"x:dossier" nodes in all cases.

Is this a bug in JackRabbit or the expected behavior?

If there a specific "null" value that I should set for "null"
references to make the left outer join work?

Thanks for you help!

Regards,

Fred

Mime
View raw message