wrong result for ino:count

Hi,
I sometimes get wrong results for ino:count when doing a query on my database. For example, if i retrieved only 5 documents, ino:count sometimes return a wrong value of 7 or 8.

This in turn affects ino:next which in turn prevents me from navigating my search results properly.

Has anyone encountered this problem as well?

Indeed, the ‘count’ mecanism is not reliable for an arbitrary query.

According to my experience, the document count is always accurate when the post-processor is not involved.

However, when the post processor is involved, the resulting document count is over-optimistic and is equal to “number of candidate documents as according to index resolution, less the number of document eliminated by post-processing AT THE POINT where you are in the cursor set”.

So you could get an announce of “100 results” when asking for 1-10, then “92 results” when asking for 11-20, etc… Count will be correct if you ask “100-100”.

There is no systematic solution announced in the current version because having correct count would imply post-processing of the whole base.

So the work-around are:
- try to have purely index-based queries (it might not be always possible, for example if you are asking not(xxx~=…))
- ask for the “last part of the result set” so that you force post-processing of the whole result set
- change your screen design to show “Next” but not “Last” and ask everytime ‘one document more’ to make sure there is a next one
- wait for “real cursor implementation” that sould come in the coming Tamino releases: but in that case I guess there will be no more count announcement

Philippe :rolleyes:


Software AG Belgium, Professional Services Division

Indeed I vaguely remember that ino:count does not work anymore in 2.3. and will be removed in future versions. So I rather would try any tricks with indexes but rather implement a counting routine in your application…
Hopefully future versions will supply a new count function.
christian campo

You will get reliable results useing the xpath count() function.

e.g. count(/book)

As fas as I know the java API of V2.3 offers you a reliable cursor handling.

I’m currently using v2.3.1.1. I’m also currently using the ActiveX API and if it is true that ino:count gives a problem, then the GetTotalCount function, IsNext, IsLast cursoring functions will not work properly as well.

btw, Joachim, what do you mean by ‘reliable cursor handling?’ I suspect the count() function relies on the result of ino:count() as it seems to be giving the same answer. The same goes for how IsNext, IsPrev etc. relies on ino:next, ino:prev etc.

I’m probably a tad distraughted because I have looked at the documentation and the functions provided in the API while at the same time building my application, but later only to find out the functions being not a 100% reliable.

I was told of the post-processing ‘problem’ only later. Currently, I don’t see any other way than to keep a manual count of results (pertaining to what I’m doing).

Thank you all for the feedback(especially to Philippe). The baffling change of a ‘100 results to 92 results’ did actually happen in my application. :rolleyes: