Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76D7E70C8 for ; Wed, 26 Oct 2011 07:22:46 +0000 (UTC) Received: (qmail 94746 invoked by uid 500); 26 Oct 2011 07:22:45 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 94714 invoked by uid 500); 26 Oct 2011 07:22:45 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 94706 invoked by uid 99); 26 Oct 2011 07:22:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 07:22:44 +0000 X-ASF-Spam-Status: No, hits=1.1 required=5.0 tests=FRT_ADOBE2,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.24.201.138] (HELO mx01.innovations.de) (217.24.201.138) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 07:22:37 +0000 X-ASG-Debug-ID: 1319613734-5acb00340000-L7RJYL X-Barracuda-URL: http://217.24.201.138:8000/cgi-bin/mark.cgi Received: from immpwamx01.innoimm.local (localhost [127.0.0.1]) by mx01.innovations.de (Spam Firewall) with ESMTP id A1BAF25CB7B for ; Wed, 26 Oct 2011 09:22:16 +0200 (CEST) Received: from immpwamx01.innoimm.local ([192.168.18.25]) by mx01.innovations.de with ESMTP id daM5Plaanw8UwjqZ for ; Wed, 26 Oct 2011 09:22:16 +0200 (CEST) X-Barracuda-RBL-Trusted-Forwarder: 192.168.18.25 X-ASG-Whitelist: Client Received: from email.innoimm.local ([192.168.18.4]) by immpwamx01.innoimm.local with Microsoft SMTPSVC(6.0.3790.4675); Wed, 26 Oct 2011 09:22:11 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-ASG-Orig-Subj: AW: AW: How do I get the total size of nodes/rows from a QueryResult Subject: AW: AW: How do I get the total size of nodes/rows from a QueryResult Date: Wed, 26 Oct 2011 09:22:09 +0200 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: How do I get the total size of nodes/rows from a QueryResult Thread-Index: AcyTW+ak2uNsw70aRq6/NlEj5GkFewAUte/w References: From: To: X-OriginalArrivalTime: 26 Oct 2011 07:22:11.0858 (UTC) FILETIME=[FA867F20:01CC93AF] X-Barracuda-Connect: UNKNOWN[192.168.18.25] X-Barracuda-Start-Time: 1319613736 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at innovations.de X-Virus-Checked: Checked by ClamAV on apache.org > You can't be using limit & offset with Jackrabbit 1.x and Xpath... Hm but I really do that and it worked: ((QueryImpl) query).setLimit(select.getLimit()); ((QueryImpl) query).setOffset(select.getOffset()); QueryResultImpl queryResult =3D (QueryResultImpl) = Executor.execute(query); queryResult.getTotalSize(); > I guess it's only that getSize() returns -1 for you now in most cases = (if > you come from Jackrabbit 1.x), as that is an optimization in the = engine. > To force a result, use the orderby @jcr:score trick mentioned by Ard. Thanks for the tip and that makes 50% of my test cases to run without = error but=20 the other 50% do not work. I stripped the error down and found out that = each query that uses a "contains" condition fails now. But the test fail not deterministic and I think that is because I add = nodes with XML content (binary) in my test cases and immediately after = adding the node I am searching for the content of the node. I think that = the XMLTextExtractor runs in a paralles Thread and the computation is = not finished when I try to query jackrabbit. I could now implement a = delay in my tests but the best solution would be to wait until the = XMLTextExtractor job is finished. Is there a possibility to do that or = am I completely wrong with my suggestion? Thanks for your help! -----Urspr=FCngliche Nachricht----- Von: Alexander Klimetschek [mailto:aklimets@adobe.com]=20 Gesendet: Dienstag, 25. Oktober 2011 23:20 An: users@jackrabbit.apache.org Betreff: Re: AW: How do I get the total size of nodes/rows from a = QueryResult On 25.10.11 18:06, "Sascha.Theves@bosch-si.com" wrote: >> Use the getSize() method of the returned node or row iterator. > >I think that returns the size of elements in the iterator and that is >hopefully not the complete size if I used the limit and offset = options... Yes, I also think it is the actual result "window" size (if given), but not the total. (But I am not 100% sure). >I used an XPath query before switching to jackrabbit 2.2.9 but I = thought >I should change my query to SQL2 because xpath is deprecated now. It is deprecated in the spec - but most Jackrabbit based systems use = xpath heavily so it is not going away soon. SQL2 on the other hand is still = very young - and while having some new features, such as joins, it is not as optimized and proven as Xpath or SQL1. (We should really put that in a FAQ). >So what is your recommendation now? Should I switch to SQL2? What about >the total size then? Or should I still use xpath? I am currently >switching because it seems that my xpath queries do not work any = longer. >A lot of tests do fail now... I have to track this down but it seems = that >I run into another backward incompatibility issue here... I guess it's only that getSize() returns -1 for you now in most cases = (if you come from Jackrabbit 1.x), as that is an optimization in the engine. To force a result, use the orderby @jcr:score trick mentioned by Ard. You can't be using limit & offset with Jackrabbit 1.x and Xpath... Cheers, Alex --=20 Alexander Klimetschek Developer // Adobe (Day) // Berlin - Basel