Skip to content

Changed the getDocs() of SortedIntDocSet to return a wrapper class Do…#308

Open
hiteshk25 wants to merge 4 commits intofs/branch_9_7from
patsonluk/SAI-6013-sorted-int-doc-set-with-wrapper
Open

Changed the getDocs() of SortedIntDocSet to return a wrapper class Do…#308
hiteshk25 wants to merge 4 commits intofs/branch_9_7from
patsonluk/SAI-6013-sorted-int-doc-set-with-wrapper

Conversation

@hiteshk25
Copy link
Collaborator

@hiteshk25 hiteshk25 commented Jan 16, 2026

…cIdList, which could have an underlying 2d or 1d array

https://issues.apache.org/jira/browse/SOLR-XXXXX

Description

Please provide a short description of the changes you're making with this pull request.

Solution

Please provide a short description of the approach taken to implement your solution.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

Note

Modernizes small doc set storage and operations.

  • Introduces SortedIntDocSet.DocIdList abstraction with 1D and 2D implementations; SortedIntDocSet now stores a DocIdList with new helpers (allocate, build, grow, shrink, shrinkClone, zeroDocSet).
  • Refactors DocSetBuilder, DocSetCollector, DocSetUtil, SolrIndexSearcher, JoinQuery, and KeepAliveRegenerator to use DocIdList (get, set, copyTo) instead of raw int[][] access.
  • Adds LSBRadixSorterMod to sort DocIdList and replaces previous sorter usage.
  • Updates set algorithms (intersection, andNot, binarySearch, iterators) to DocIdList.
  • Tests updated to cover both DocIdList implementations.

Written by Cursor Bugbot for commit 7468496. This will update automatically on new commits. Configure here.

…cIdList, which could have an underlying 2d or 1d array
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 18

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

} else {
while ((docid = postingsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
docs[upto >> SortedIntDocSet.WORDS_SHIFT][upto++ & SortedIntDocSet.ARR_MASK] = docid;
docs.set(upto, docid);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing counter increment causes empty search results

High Severity

The upto counter is not incremented in the while loop at docs.set(upto, docid). The original code used upto++ in the array index expression, but during refactoring to use DocIdList.set(), the increment was accidentally dropped. Since upto determines the result size and is checked later (upto == 0 ? DocSet.empty() : ...), this causes all documents to be written to index 0 and the final result to be empty. This affects single-segment searches with small result sets.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants