这是indexloc提供的服务,不要输入任何密码
Skip to content

retrieve multiple items from an index index out of bounds error #480

@stelar7

Description

@stelar7

When running retrieve multiple items from an index with the nextunique or prevunique direction, we iterate over items in a while loop.

  1. Let i be 0.
  2. While i is less than rangeRecordsLength, then:
    1. Increase i by 1.
    2. if record’s size is equal to count, then break.
    3. If the result of comparing two keys using the keys from |rangeRecords[i]| and |rangeRecords[i-1]| is equal, then continue.
    4. Else append |rangeRecords[i]| to records.

This means

  • range_records[0] will never be added to records.
    • We always start with i = 1
  • In the last iteration, we will try to access range_records[length], and that is out of bounds.
    • We check for less than, then increment it to be equal

Suggested solution:

  • Change While i is less than range records length to While i is less than range records length - 1
  • Add new step between current 3 and 4:
    • Append |range records[0]| to records.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions