RavenDB延迟搜索抛出URI太长的异常

时间:2011-11-04 11:42:09

标签: exception post ravendb

我的理解是raven db中的Lazy搜索使用了multiget,它使用post而不是get。因此,不强加URI长度限制。但是,随着以下失败的测试,我懒惰地执行查询并仍然获得URI太长的异常。我错过了什么?

注意:我需要使用Linq来构建谓词。

    [Test]
    public void UseLongUriForLazySearch()
    {
        BuilderSetup.DisablePropertyNamingFor<User, string>(x => x.Id);
        const int totalUsers = 2000;
        var users = Builder<User>.CreateListOfSize(totalUsers).All()
            .With(x => x.FirstName = GetRandom.FirstName())
            .With(x => x.LastName = GetRandom.LastName())
            .Build();

        using (GetNewServer())
        using (var store = new DocumentStore { Url = _serverAddress }.Initialize())
        {
            using (var session = store.OpenSession())
            {
                foreach (var user in users)
                    session.Store(user);

                session.SaveChanges();
            }

            using(var session = store.OpenSession())
            {
                var ids = new List<string>();
                var added = 0;
                const int needed = 1900;
                const int limit = 1024;
                while (added < needed)
                {
                    ids.AddRange(session.Query<User>().Select(x => x.Id).Skip(added).Take(needed - added).ToList());
                    added += limit;
                }

                var query = session.Query<User>().Where(x => x.Id.In(ids));

                RavenQueryStatistics stats;
                var results = query.Statistics(out stats).Skip(10).Take(100).Lazily();

                Assert.AreEqual(100, results.Value.ToList().Count);

                Assert.AreEqual(needed, stats.TotalResults);
            }
        }
    }

我为任何感兴趣的人追加完整的堆栈跟踪。我正在使用build 499。

System.UriFormatException:无效的URI:Uri字符串太长。

服务器堆栈跟踪: 在System.Uri.EscapeString(String输入,Int32 start,Int32 end,Char [] dest,ref Int32 destPos,Boolean isUriString,Char force1,Char force2,Char rsvd) 在System.Uri.EscapeUriString(String stringToEscape) 在Raven.Abstractions.Data.IndexQuery.AppendQueryString(StringBuilder路径)中的c:\ Builds \ raven \ Raven.Abstractions \ Data \ IndexQuery.cs:第138行 在Raven.Client.Document.Batches.LazyQueryOperation 1.CraeteRequest() in c:\Builds\raven\Raven.Client.Lightweight\Document\Batches\LazyQueryOperation.cs: line 26 at Raven.Client.Document.DocumentSession.<ExecuteLazyOperationsSingleStep>b__9(ILazyOperation x) in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentSession.cs: line 618 at System.Linq.Enumerable.WhereSelectListIterator 2.MoveNext() 在System.Linq.Buffer 1..ctor(IEnumerable 1来源) at System.Linq.Enumerable.ToArray(IEnumerable 1 source) at Raven.Client.Document.DocumentSession.ExecuteLazyOperationsSingleStep() in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentSession.cs: line 618 at Raven.Client.Document.DocumentSession.ExecuteAllPendingLazyOperations() in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentSession.cs: line 595 at Raven.Client.Document.DocumentSession.<>c__DisplayClass5 1.b__3()in c:\ Builds \ raven \ Raven.Client.Lightweight \ Document \ DocumentSession.cs:line 566 在System.Lazy`1.CreateValue()

0 个答案:

没有答案