jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich <For...@gombers.de>
Subject JCR-JQOM: QueryObjectModelFactory.OR - combined query fails with Lucene error: TooManyClauses: maxClauseCount is set to 1024
Date Tue, 11 Jun 2013 15:18:14 GMT
The repository contains nt:file-nodes with an optional mixin-property of type
DATE. I need to find all nodes which don't have this property or where the
specified date is before a given date.
My code is:
try {
        // get all files in subtree
        Constraint getSubtree =
qomf.descendantNode(nodeTypeSelector.getSelectorName(), subtree);

        // if they have a property defined indicating that they already have
been virusscanned
        Constraint needRescan = qomf.and(getSubtree,
        // but scandate is outdated
        Comparison compareDate = qomf.comparison(lastScannedDateOperand,
        needRescan = qomf.and(needRescan, compareDate);

        // OR
        // if nodes have not been scanned yet
        Constraint needInitalScan = qomf.and(getSubtree,


        QueryObjectModel qom = qomf.createQuery(nodeTypeSelector,
qomf.or(needInitalScan, needRescan), null, null);
        QueryResult queryResult = qom.execute();
        nodeIterator = queryResult.getNodes();
} catch (InvalidQueryException e) {

The query fails for a large subtree with a lucene-error:
        org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is
set to 1024

If I split the query:
   QueryObjectModel qom = qomf.createQuery(nodeTypeSelector, needInitalScan,
null, null);
   QueryObjectModel qom = qomf.createQuery(nodeTypeSelector, needRescan, null,

it works fine in my test-environment. I could live with this; it's a little bit
of effort to combine the both of the lists, but that's ok. Nevertheless it looks
suboptimal and I would like to ask if there isn't a way to improve it.
And I might get in trouble if running the queries at a larger system. So I'd
like to know what's the reason for the error - I've no clue. I found a nice
explanation here "http://dalelane.co.uk/blog/?p=2081" and this page
The latter mentioned issue should be solved with

So any comment is appreciated.

View raw message