Fix limit/offset handling when sort option is no sort.

Review Request #125544 - Created Oct. 7, 2015 and submitted

Xuetian Weng
baloo, release-team

The bug is obvious, old code uses limit instead of (limit > 0), which gracefully handles limit < 0 case (means everything).

After offset is introduced, limit < 0 case is not handled properly.

This patch contains following changes:
1. make offset uint, m_offset is uint in Query already.
2. handle limit < 0 case properly.

Also fix offset with sorting.

baloosearch:/ doesn't return anything because of this, now it properly returns result.

Play with baloosearch command a little bit, offset and limit returns the [offset, offset + limit) and no crash on the border case.


  • 0
  • 2
  • 1
  • 3
Description From Last Updated
Vishesh Handa
Xuetian Weng
Emmanuel Pescosta
Luca Beltrame
Xuetian Weng
Xuetian Weng
Vishesh Handa
Xuetian Weng
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 64c57e56fe3392cf057ac2948cddb1e5a011a0c1 by Weng Xuetian to branch master.
Boudhayan Gupta

src/lib/searchstore.cpp (Diff revision 2)

Shouldn't this be qMin(size, offset + limit)?

  1. I don't think it matters.

    If there aren't any more elements then it->next() will be false.

  2. Ah, right. Silly me.

    I'm dropping the issue.