Querying Static Indexes

26 vistas
Ir al primer mensaje no leído

Priti Desai

no leída,
19 sept 2014, 9:06:01 a.m.19/9/14
para rav...@googlegroups.com

I have created a static Index which queries the Data to get data from past 3 hours.. However it worked fine.. But after sometime it gets me the same resultset everytime.

Shouldn’t the Result set keep changing ? since I am querying DateTime

Oren Eini (Ayende Rahien)

no leída,
19 sept 2014, 9:52:31 a.m.19/9/14
para ravendb
No, it isn't.
Indexing is run once, that is why DateTime.Now isn't allowed in indexing.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Sep 19, 2014 at 3:06 PM, Priti Desai <pritisu...@gmail.com> wrote:

I have created a static Index which queries the Data to get data from past 3 hours.. However it worked fine.. But after sometime it gets me the same resultset everytime.

Shouldn’t the Result set keep changing ? since I am querying DateTime

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Priti Desai

no leída,
19 sept 2014, 4:49:23 p.m.19/9/14
para rav...@googlegroups.com
Than how can i query dynamically ? I need data from say past 3 hours and I dont want to write index everytime for that in Raven DB ?

Kijana Woodard

no leída,
19 sept 2014, 5:07:05 p.m.19/9/14
para rav...@googlegroups.com
What are you trying to do?

*warning: gmail code
.Where(x => x.Modified >= DateTime.UtcNow.AddHours(-3))

The best would be to write a small test that we can run and modify.


--

Oren Eini (Ayende Rahien)

no leída,
19 sept 2014, 5:08:41 p.m.19/9/14
para ravendb

from measurement in docs.Measurements

where measurement.Value!=0 &&

select new {

   measurement.TimeStamp ,

     SensorId = measurement.SensorId,

                Value = measurement.Value,

                TimeStamp = measurement.TimeStamp,

                Description=measurement.MeasurementUnit.Description        

}



session.Query<Measurement>()
   .Where(x=>x.Timestamp > DateTime.Now.AddHours(-3))
  .ToList();

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos