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 B721C973B for ; Tue, 25 Oct 2011 21:20:53 +0000 (UTC) Received: (qmail 23463 invoked by uid 500); 25 Oct 2011 21:20:53 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 23433 invoked by uid 500); 25 Oct 2011 21:20:53 -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 23423 invoked by uid 99); 25 Oct 2011 21:20:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 21:20:53 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aklimets@adobe.com designates 64.18.1.27 as permitted sender) Received: from [64.18.1.27] (HELO exprod6og111.obsmtp.com) (64.18.1.27) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 21:20:45 +0000 Received: from outbound-smtp-1.corp.adobe.com ([192.150.11.134]) by exprod6ob111.postini.com ([64.18.5.12]) with SMTP; Tue, 25 Oct 2011 14:20:25 PDT Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id p9PLIlYE026425 for ; Tue, 25 Oct 2011 14:18:47 -0700 (PDT) Received: from nacas01.corp.adobe.com (nacas01.corp.adobe.com [10.8.189.99]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id p9PLKN5R015332 for ; Tue, 25 Oct 2011 14:20:23 -0700 (PDT) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas01.corp.adobe.com (10.8.189.99) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 25 Oct 2011 14:20:23 -0700 Received: from eurmbx01.eur.adobe.com ([10.128.4.32]) by eurhub01.eur.adobe.com ([10.128.4.30]) with mapi; Tue, 25 Oct 2011 22:20:21 +0100 From: Alexander Klimetschek To: "users@jackrabbit.apache.org" Date: Tue, 25 Oct 2011 22:20:13 +0100 Subject: Re: AW: How do I get the total size of nodes/rows from a QueryResult Thread-Topic: AW: How do I get the total size of nodes/rows from a QueryResult Thread-Index: AcyTW+ak2uNsw70aRq6/NlEj5GkFew== Message-ID: In-Reply-To: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.13.0.110805 acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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