Be a little careful, spaces here can mess you up. Particularly around the hyphen in -1hour. I.e. NOW -1HOUR is invalid but NOW-1HOUR is ok (note the space between W and -). There aren't any in your example, but just to be sure....
One other note: you may get better performance out of making this a filter query fq, so it can be re-used, but you'll want to do some date rounding, see: http://searchhub.org/dev/2012/02/23/date-math-now-and-filter-queries/ But one easy place to look at what eventually gets to Solr is the Solr logs, the queries are all put in that file as they come in (along with a lot of other stuff), so you have a chance to see whether what you're doing in Chef is getting to Solr as you wish... Best Erick On Mon, Sep 24, 2012 at 9:42 AM, Jack Krupansky <j...@basetechnology.com> wrote: > That looks like a valid Solr date math expression, but you need to make sure > that the field type is actually a Solr "DateField" as opposed to simply an > integer Unix time value. > > -- Jack Krupansky > > -----Original Message----- From: Christian Bordis > Sent: Monday, September 24, 2012 7:16 AM > To: solr-user@lucene.apache.org > Subject: Range operator problems in Chef ( automating framework) > > > Hi Everyone! > > We doing some nice stuff with Chef > (http://wiki.opscode.com/display/chef/Home). It uses solr for search but > range queries don't work as expected. Maybe chef, solr just buggy or I am > doing it wrong ;-) > > In chef I have bunch of nodes witch timestamp attribute. Now want search > nodes with have timestamp not older than on hour: > > search(:node, "role:JSlave AND ohai_time:[NOW-1HOUR TO *]") > > Is this string in the call a solr compliant range expression at all? > Unluckily, I have no toys at hand to verify this myself at the moment... > but I work on this. > > Thanks for reading! ^^ > > Kind Regards, > > Christian Bordis