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:


			QueryObjectModelFactory factory =
			ValueFactory vf = session.getValueFactory();
			Source selDossier = factory.selector("x:dossier", "dossier");
			Source selEtat     = factory.selector("x:dictionnaryEntry", "etatDossier");
			Source selClasse     = factory.selector("x:dictionnaryEntry",
			//JoinCondition dossierClasse =
factory.equiJoinCondition("dossier", "x:classe", "classeDossier",
			//JoinCondition dossierEtat   =
factory.equiJoinCondition("dossier", "x:etat", "etatDossier",
			JoinCondition dossierClasse =
factory.equiJoinCondition("classeDossier", "jcr:uuid", "dossier",
			JoinCondition dossierEtat   =
factory.equiJoinCondition("etatDossier", "jcr:uuid","dossier",
			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,
			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();

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!



View raw message