为什么查询只返回前100个用户?

时间:2015-09-11 16:29:57

标签: parse-platform

我希望得到40个用户"得分"小于或等于某个值,40个用户"得分"大于或等于相同的值。但是这两个查询只返回前100个用户,这些用户按降序排序。 这是代码的一部分

var query = ParseUser.Query;

        if(mode==0)
        {
            query.WhereNotEqualTo("fbLogged", true)
                 .WhereNotEqualTo("username", SaveManager.Instance.TempUsername)
                 .WhereGreaterThanOrEqualTo("score", SaveManager.Instance.Score)
                 .Limit(40);
        }

        query.FindAsync().ContinueWith(t =>
        {
            if (t.IsCanceled || t.IsFaulted)
            {
                foreach (var e in t.Exception.InnerExceptions)
                    Debug.LogError("Error: " + e.Message);
                return;
            }
            else
            {
                var query1 = ParseUser.Query;

                if(mode==0)
                {
                    query1.WhereNotEqualTo("fbLogged", true)
                    .WhereNotEqualTo("username", SaveManager.Instance.TempUsername)
                    .WhereLessThanOrEqualTo("score", SaveManager.Instance.Score)
                    .Limit(40);
                }

                query1.FindAsync().ContinueWith(t1=>
                {
                    Debug.Log("first query count: " + t.Result.ToList().Count);
                    Debug.Log("second query count: " + t1.Result.ToList().Count);

                    var r = t.Result.ToList();
                    r.AddRange(t1.Result.ToList());

                    List<UserRank> ranks = new List<UserRank>();
                    r.ForEach(info => { ranks.Add(RetrieveUserRankData((ParseUser)info)); });

                    ranks = ranks.OrderByDescending(ur => ur.Score).ToList();

                    UserRank first = ranks.First();
                    UserRank last = ranks.Last();

                    Debug.Log("my score: " + SaveManager.Instance.Score);
                    Debug.Log("first name and score: " + first.Name + " " + first.Score);
                    Debug.Log("last name and score: " + last.Name + " " + last.Score);

此处还有日志

enter image description here

我做错了什么?

1 个答案:

答案 0 :(得分:0)

默认情况下,查询默认限制为100行。并且最大行数为1000.要增加限制,请使用query.setLimit(1000)将查询行数增加到1000.