搜索失败,并设置了maxid(ulong.max)和Sirid,但单独运行 [英] search fails with maxid (ulong.max) and sinceid set, but separately it works

查看:87
本文介绍了搜索失败,并设置了maxid(ulong.max)和Sirid,但单独运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您注释掉DuenceID或MaxID子句,则下面的查询可以正常工作,但是同时包含这两个查询时,会生成错误网址"异常.

the following query works ok if you comment out either the SinceID or the MaxID clause, but when both are included a "bad url" exception is generated.

var maxId = ulong.MaxValue;
var sinceId = (ulong)341350918903701507;

var searchResult =
(
   from search in ctx.Search
      where search.Type == SearchType.Search &&
      search.ResultType == ResultType.Mixed &&
      search.Query == "red wedding" &&
      search.SinceID == sinceId &&
      search.MaxID == maxId &&
      search.IncludeEntities == false &&
      search.Count == 200
    select search).SingleOrDefault();

推荐答案

如果在Fiddler中查看查询结果,您将看到响应为:

If you look at the query result in Fiddler, you'll see that the response is:

{"errors":[{"code":195,"message":"Missing or invalid url parameter"}]}

我无法回答为何Twitter既不接受带有SirID和MaxID的查询的原因.但是,查询的格式正确,并且没有任何文档描述此特定情况下这两个参数之间的关系约束. MaxID的目的是成为在下一个查询中返回的最高推文的ID. MaxID和SinceID都旨在帮助您分页浏览数据.我写了一篇有关如何执行此操作的博客文章:

I can't respond to why Twitter wouldn't accept the query with both SinceID and MaxID. However, the query is formed correctly and there isn't any documentation describing constraints on the relationship between these two parameters for this particular scenario. The purpose of the MaxID is to be the id of the highest tweet to return on the next query. Both MaxID and SinceID are intended to help you page through data. I wrote a blog post on how to do this:

使用时间轴和LINQ to Twitter

这篇关于搜索失败,并设置了maxid(ulong.max)和Sirid,但单独运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆