Hi Benjamin,
the QueryObjectModel in jackrabbit is work in progress and not usable in it's
current state.
the equivalent JQOM to your query would be:
qf.createQuery(
qf.join(
qf.selector("nt:file", "f"),
qf.selector("nt:resource", "r"),
qf.JOIN_TYPE_INNER,
qf.sameNodeJoinCondition("r", "f", "jcr:content")),
qf.fullTextSearch("r", null, "Test"),
null,
new Column[] { qf.column("f", null, null) }));
regards
marcel
Benjamin Papez wrote:
Hello,
I am already testing with your JSR283 QueryObjectModel implementation and have a
question regarding the proper usage.
The XPATH query, which I try to implement with the JQOM is:
//element(*,nt:file)[jcr:contains(jcr:content,'Test')]
Internally it results in a Lucene query:
+(_:PROPERTIES:3:primaryType?4:file _:PROPERTIES:3:primaryType?12:file
_:PROPERTIES:3:primaryType?12:symLink) +ParentAxisQuery
while the ParentAxisQuery is:
+_:LABEL:3:content +_:FULLTEXT:test
With this I get some results.
Now I am trying to build this same query with the QueryObjectModel. What I do
is:
qf.createQuery(qf.selector("nt:file"), qf.fullTextSearch(*null*, 'Test'),
*null*, *null*);
The resulting query looks like this:
+(_:PROPERTIES:3:primaryType?4:file _:PROPERTIES:3:primaryType?12:file
_:PROPERTIES:3:primaryType?12:symLink) +_:FULLTEXT:test
With this I get no results.
The JSR-283 documentation says for FullTextSearch:
If *propertyName *is specified, the full-text search scope is the property of
that name on the *selectorName *node in the node-tuple; otherwise the
full-text search scope is all properties of the *selectorName *node (or, in
some implementations, all properties in the node subtree).
It looks like in the current implementation Jackrabbit is not searching through
the subtree nodes, but anyway this will be implementation specific.
What is the proper way to create a query with the JQOM, which will run on all
implementations and where the FullTextSearch will look in all the subtree nodes?
I would also like to extend this query by looking in the filename, so I would
always like to return nt:file nodes.
Regards,
Benjamin