Querying Static Indexes

26 weergaven
Naar het eerste ongelezen bericht

Priti Desai

ongelezen,
19 sep 2014, 09:06:0119-09-2014
aan 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)

ongelezen,
19 sep 2014, 09:52:3119-09-2014
aan 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

ongelezen,
19 sep 2014, 16:49:2319-09-2014
aan 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

ongelezen,
19 sep 2014, 17:07:0519-09-2014
aan 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)

ongelezen,
19 sep 2014, 17:08:4119-09-2014
aan 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

 


Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten