Я пытаюсь получить все записи определенного типа из RavenDB с C#.Выберите все записи типа
Когда я использую Lucene:
var serviceTraces = session.Advanced.LuceneQuery<ServiceTrace>("IDLoadDateIndex").Take(50);
я получаю результаты в:
serviceTraces.QueryResult.Results
Когда я не использую Lucene:
var serviceTraces = session.Query<ServiceTrace>("IDLoadDateIndex").Take(50);
Я не получаю никаких результатов, и при попытке выполнить «ToList()» возникает исключение o n "serviceTraces" объект.
Почему?
UPDATE:
ServiceTrace класс:
public class ServiceTrace
{
public ServiceTrace(ServiceDeployment sd)
{
// TODO: Complete member initialization
this.ServiceDeploymentID = sd.Id;
}
public string Id { get; set; }
public string TransactionID { get; set; }
public string ParentTransactionID { get; set; }
public string RequestID { get; set; }
public int ApplicationCode { get; set; }
public int InstituteCode { get; set; }
public string ServiceDeploymentID { get; set; }
public string UserHostAddress { get; set; }
public string UserAgent { get; set; }
public string Username { get; set; }
public DateTime RequestDateTime { get; set; }
public DateTime ResponseDateTime { get; set; }
public string RequestBody { get; set; }
public string ResponseBody { get; set; }
public string Key1Value { get; set; }
public string Key2Value { get; set; }
public string Key3Value { get; set; }
public string Key4Value { get; set; }
public string Key5Value { get; set; }
public int StatusCode { get; set; }
public string StatusDescription { get; set; }
public string FullExceptionText { get; set; }
public DateTime LoadDate { get; set; }
public DateTime ActivationDateTime { get; set; }
public string HostAddress { get; set; }
public string BpmID { get; set; }
public DateTime PreProcessDatetime { get; set; }
public string DestHostAddress { get; set; }
public string ArchivePath { get; set; }
public string BTInstanceID { get; set; }
public string Temp1 { get; set; }
public string ExternalComponentDuration { get; set; }
public string SQLIdentity { get; set; }
public string ExceptionCode { get; set; }
public string CertificateID { get; set; }
public string ExternalComponentType { get; set; }
public string ActivationID { get; set; }
}
IDLoadDateIndex:
public class IDLoadDateIndex : AbstractIndexCreationTask<ServiceTrace>
{
public IDLoadDateIndex()
{
Map = serviceTrace => from st in serviceTrace
select new { LoadDate = st.LoadDate };
Index(x => x.LoadDate, FieldIndexing.Analyzed);
}
}
Какое исключение вы получаете? И как выглядит 'IDLoadDateIndex'? –
Я обновил свой вопрос – ohadinho
Не уверен, что это причина, но вы не должны указывать поле 'DateTime' как проанализированное. Это бессмысленно. Удалите эту строку из своего индекса. Также, пожалуйста, отправьте исключение, которое вы получаете. –