首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RavenHQ索引查询返回(500)内部服务器错误

RavenHQ索引查询返回(500)内部服务器错误
EN

Stack Overflow用户
提问于 2012-11-11 10:46:54
回答 1查看 139关注 0票数 0

我最初的问题可以在这里找到:RavenDB Index Query Question

我现在使用下面的索引得到了很好的效果:

代码语言:javascript
复制
public class JobsQueuedListCurrent : AbstractIndexCreationTask<AppointmentReminder, JobsQueuedListCurrent.IndexResult>
{
    public class IndexResult
    {
        public int Id { get; set; }
        public DateTime AppointmentDateTime { get; set; }
        public ReminderStatus ReminderStatus { get; set; }
        public DateTime JobDateTime { get; set; }
        public JobStatus JobStatus { get; set; }
    }

    public JobsQueuedListCurrent()
    {


        Map = appointmentreminders => from appointmentreminder in appointmentreminders
                                      from job in appointmentreminder.NotificationJobs
                                      where (appointmentreminder.ReminderStatus != ReminderStatus.Confirmed)

                                      select new 
                                      { 
                                          Id = appointmentreminder.Id, 
                                          AppointmentDateTime = appointmentreminder.AppointmentDateTime,
                                          ReminderStatus = appointmentreminder.ReminderStatus,
                                          JobDateTime = appointmentreminder.AppointmentDateTime.AddDays(job.DaysOffset),
                                          JobStatus = job.JobStatus
                                      };

        Store(x => x.AppointmentDateTime, FieldStorage.Yes);
        Store(x => x.ReminderStatus, FieldStorage.Yes);
        Store(x => x.JobDateTime, FieldStorage.Yes);
        Store(x => x.JobStatus, FieldStorage.Yes);

    }
}

我将我的代码从本地机器转移到AppHarbor和RavenHQ。我现在可以在Appharbor和RavenHQ中连接和查询普通数据。我的控制器看起来像:

代码语言:javascript
复制
public ActionResult GetJobsQueuedListCurrent()
    {
        var jobsqueuedlist = RavenSession.Query<JobsQueuedListCurrent.IndexResult, JobsQueuedListCurrent>()
            .OrderBy(x => x.AppointmentDateTime)
            .As<AppointmentReminder>()
            .Take(20)
            .ToList();

        return View("List", jobsqueuedlist);

    }

当我添加以下where子句时,它可以很好地工作:

代码语言:javascript
复制
.Where(x => (x.JobDateTime <= DateTime.Now))

这样控制器看起来就像:

代码语言:javascript
复制
public ActionResult GetJobsQueuedListCurrent()
    {
        var jobsqueuedlist = RavenSession.Query<JobsQueuedListCurrent.IndexResult, JobsQueuedListCurrent>()
            .Where(x => (x.JobDateTime <= DateTime.Now))
            .OrderBy(x => x.AppointmentDateTime)
            .As<AppointmentReminder>()
            .Take(20)
            .ToList();

        return View("List", jobsqueuedlist);

    }

这现在会导致错误(500):内部服务器错误,指向输出的粘贴箱的链接如下:

Pastebin

如何才能允许查询在Where子句中使用datetime?顺便说一句,我在我的客户端上使用最新的不稳定(1.2.2139-不稳定)来与RavenHQ交谈。谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-11 17:18:15

您正在使用1.2客户端与1.0服务器通信。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13328167

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档