lucene.net - In Sitecore how to run a date range query using Lucene? -
i need able run date range query in sitecore using lucene , newest sitecore.search
framework.
does know how this?
i haven't been able find example. have googled bit , found bits , pieces here , there.
you can find similar question here: how lucene search sitecore item specific date?
just treat fields standard string fields , execute range query starting e.g. 20130418t000000 including value , ending on 20130819t000000
this method works me:
private static void createcreateddatesquerypart(booleanquery query, string createdfrom, string createdto) { if (!string.isnullorempty(createdfrom) || !string.isnullorempty(createdto)) { if (string.isnullorempty(createdfrom)) { createdfrom = "000000t000000"; } if (string.isnullorempty(createdto)) { createdto = "999999t999999"; } query.add(new termrangequery("__created", createdfrom, createdto, true, true), booleanclause.occur.must); } }
here can find more information solving sitecore , lucene problems.
Comments
Post a Comment