Skip to content

Limit(offset, count) returning combined total of records, not count quantity. #508

Closed

Description

@WEWebTeam

For example I create a query using Limit(20, 10), it returns 30 documents instead of just 10.

var db = _connectionMultiplexer.GetDatabase();
var json = db.FT();
var query = new Query("*").SetNoContent(false).SetSortBy("", true).Limit(search.start, search.length);
var results = json.Search("idx1", query);

I've tried with variations, removing the extra setnotcontent and sort but I get the same result.

If I directly query my redis database it works as expected and I only get 10 records back:

FT.SEARCH 'idx1' '*' LIMIT 20 10 SORTBY ASC

I'm using version 1.6.0.

Activity

  1. WEWebTeam commented on Jun 22, 2026

    @WEWebTeam
    Author

    After a lot of trial and error, finally narrowed it down to the protocol specified in the connect. If using Resp3 it causes the above issue. If I specify Resp2, then it works as expected. I'm not sure if that's a bug or if something else needs to happen to make it work with Resp3, so I'll leave this open for your review. If nothing else, it might be worth noting the setting somewhere in your documentation. Thanks!

  2. mgravell commented on Jul 3, 2026

    @mgravell
    Collaborator

    Sorry, RESP2 Vs RESP3 has a bunch of annoying deltas. I thought we'd caught them all. Will fix and release ASAP.

  3. mgravell commented on Jul 6, 2026

    @mgravell
    Collaborator

    so I added a test for this (here - locally, it passes for RESP2 and RESP3; I'm waiting on CI, but are you absolutely sure you're using 1.6.0? previous versions would have failed for this

  4. mgravell commented on Jul 6, 2026

    @mgravell
    Collaborator

    Assert.Equal() Failure: Values differ
    Expected: 10

    (From CI) Huh. Well this is going to be fun! Very odd, investigating. Now I need to figure out why it passes locally!

  5. mgravell commented on Jul 6, 2026

    @mgravell
    Collaborator

    ah, cluster-specific:

    Passed Search.SearchTests.TestSearchLimitOffset(endpointId: "standalone") (Resp2) [7 ms]
    Passed Search.SearchTests.TestSearchLimitOffset(endpointId: "standalone") (Resp3) [9 ms]
    Passed Search.SearchTests.TestSearchLimitOffset(endpointId: "cluster") (Resp2) [14ms]
    Failed Search.SearchTests.TestSearchLimitOffset(endpointId: "cluster") (Resp3) [14 ms]

  6. mgravell commented on Jul 6, 2026

    @mgravell
    Collaborator

    So this appears to be a server bug, not a client bug; reported here: RediSearch/RediSearch#10369

  7. added a commit that references this issue on Jul 6, 2026
  8. mgravell commented on Jul 7, 2026

    @mgravell
    Collaborator

    While we wait on the modules folks, you can disable RESP3 as via: https://stackexchange.github.io/StackExchange.Redis/Resp3

  9. mgravell commented on Jul 9, 2026

    @mgravell
    Collaborator

    Fixed at server for next release, including backported: RediSearch/RediSearch#10369 - I literally can't do anything more than that. Sorry you had this problem.

  10. WEWebTeam commented on Jul 10, 2026

    @WEWebTeam
    Author

    Thanks for tracking it down. I'll check for the server fix.

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

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