[infinispan-dev] broken lazy query iteration

Ales Justin ales.justin at gmail.com
Fri Oct 26 10:09:24 EDT 2012


After searching for the needed in haystack, I finally found the problem.
(not to mention complete lack of tests for this *basic* feature ...)

The problem is with queries with offset when you iterate over them -- offset is never taken into account.

There are two possible fixes -- as I see them.

1) In HS:

DocumentExtractorImpl::extract takes into account "firstIndex"

	public EntityInfo extract(int scoreDocIndex) throws IOException {
		int docId = queryHits.docId( firstIndex + scoreDocIndex );
		Document document = extractDocument( fistIndex + scoreDocIndex );

2) LazyIterator in Infinispan-Query applies the offset:

   protected EntityInfo loadEntityInfo(int index) {
      try {
         return extractor.extract(extractor.getFirstIndex() + index);

---

Since those methods are exposed in DocumentExtractor,
I would guess they were meant for external code to use them,
instead of putting this logic into extractor itself.

So, I'll go ahead and provide a patch for (2).

-Ales




More information about the infinispan-dev mailing list