Thankyou Erick, The requirement doesn't really let me use the query like that.
Rather, what I would be storing in my document is the day number. E.g: Day : 1, Day : 2 etc I can even store this in milliseconds like 86400000,172800000. And I want to compare if those days falls within the difference of current day and another day. Something like below. StoredDay_ms:ms(NOW/DAY+1DAY,NOW/DAY) And it should return the documents with values set to 86400000 as StoredDay_ms. Thank you very much, Really appreciate your help. On Wed, Nov 23, 2016 at 6:20 PM, Erick Erickson <erickerick...@gmail.com> wrote: > I wouldn't do it this way, it's far more complex than you need. Try > fq=Startdate__D:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]. > > Why the weird NOW/DAY+1DAY? Well, that makes fq clauses far > more likely to be reused, see: > https://lucidworks.com/blog/2012/02/23/date-math-now-and-filter-queries/ > > Best, > Erick > > On Tue, Nov 22, 2016 at 7:29 PM, Sadheera Vithanage <sadhee...@gmail.com> > wrote: > > Hi All, > > > > I am struggling to get the difference of 2 days and return the matching > > documents. > > > > I got the below function query to work, however I am unable to pass a > > fieldname for *u *in frange function. > > > > {!frange l=0 u=864000000}ms(NOW,StartDate__d) > > > > > > What I really want to do is compare the start date with today's date and > > return the documents that falls within a date range.For example 7 days. > > > > Thank you. > > > > -- > > Regards > > > > Sadheera Vithanage > -- Regards Sadheera Vithanage