[infinispan-dev] broken lazy query iteration

Emmanuel Bernard emmanuel at hibernate.org
Mon Oct 29 06:14:52 EDT 2012


Correct, the DocumentExtractor contract expects the absolute index. It
looks like a bug in how ISPN's Query module use it.

Emmanuel

On Fri 2012-10-26 16:09, Ales Justin wrote:
> 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