开发者

RavenDB paging with Skip and Take does not work [closed]

T开发者_如何学JAVAhis question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I am trying to implement a query on a RavenDB Lucene index and paging the results.

I have the following code:

        IDocumentQuery<Post> q = Session.Advanced.LuceneQuery<Post, Posts_Search>()
            .WhereContains("BodyHtml", query)
            .OrElse()
            .WhereContains("Title", query)
            .AddOrder("Published", true)
            .Skip(4).Take(4);

(The last pair of Skip and Take was added for the sake of a simple example).

This query always returns all of the 22 documents that matches my query, not only 4, as I would expect.

What am I doing wrong ?


This problem was occuring on the latest stable build (206).

I have now downloaded the latest unstable build (251), and with this build, my code works as expected. I guess it was a bug in the version I was using. If I get anything more meaningful insight from my question in the RavenDB group, I will make sure to post it here.


Just a guess here as I don't know RavenDB. But perhaps the Raven provider does not support skip or take.

You could try converting to an IEnumerable after your .AddOrder to verify that. (You would then be using Linq to Objects to Skip and Take, note you would still be getting all your records from the DB first)

  ...
  .AddOrder("Published",True)
  .AsEnumerable()
  .Skip(4).Take(4);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜