Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2448

Queries with offset are broken for iteration


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.2.0.Beta3
    • 5.2.0.Beta2
    • Embedded Querying
    • None

      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.

            rh-ee-galder Galder ZamarreƱo
            ajustin@redhat.com Ales Justin
            0 Vote for this issue
            1 Start watching this issue