AnsweredAssumed Answered

Date range in lucene query

Question asked by cperez on Sep 23, 2014
Latest reply on Sep 29, 2014 by kaynezhang
Hi all

I need to incorporate a lucene Serach for docs in a specified location on a particular date range (from fixed date to today less 1 hour). I have used the following lucene query but I get all the documents modified to the same moment as the query is executed.


var today = new Date();
//Start date
var sdate="2010\-01\-01T00:00:00";
//end date, today one hour early
var tdate=today.getFullYear()+"\-"+(today.getMonth()+1)+"\-"+today.getDate()+"T"+(today.getHours()-1)+":00:00";
//var spath="'+PATH:\""+aprobados.displayPath +"/\" + ";
var spath="+PATH:\"/app:company_home/cm:My_space/cm:testing//*\" +";
var scontent="@\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:image/tiff + ";
var qdate="@cm\\:modified:[" + sdate + " TO " + tdate +"]";
//var strq=spath+scontent+qdate;
var strq=spath+scontent+qdate;

// Do the search and save the vales
var nodes=search.luceneSearch(strq);


The problem: I don't want to get the document in the last hour like is defined in "qdate" (I use it in other querys wher I don't want the hour, but now it is necesary) but I get all the document to exute moment.

How can i solve it??
Thanks a lot in advance

Outcomes