Re: selecting documents older than 4 hours

2010-04-05 Thread Chris Hostetter

: NOW/HOUR-5HOURS evaluates to 2010-03-31T21:00:00 which should not be the
: case if the current time is Wed Mar 31 19:50:48 PDT 2010. Is SOLR converting
: NOW to GMT time? 

1) NOW means Now ... what moment in time is happening right at this 
moment is independent of what locale you are in and how you want to format 
that moment to represent it as a string.

2) Solr always parses/formats date time vlaues in UTC because Solr has no 
way of knowing what timezone the clients are in (or if some clients are in 
differnet timezones from eachother, or if the index is being replicated 
from a server in one timezone to a server i na differnet timezone, 
etc...).  The documentation for DateField is very explicit about this 
(it's why the trailing Z is mandatory)

3) Rounding is always done relative UTC, largely for all of the same 
reasons listed above.  If you want a specific offset you have to add it in 
using the DateMath syntax, ie...

last_update_date:[NOW/DAY-7DAYS+8HOURS TO NOW/HOUR-5HOURS+8HOURS]


-Hoss



Re: selecting documents older than 4 hours

2010-04-03 Thread herceg_novi

Ok, 

Field type is as follows: 

fieldType name=date class=solr.DateField sortMissingLast=true
omitNorms=true/

field name=last_update_date type=date indexed=true stored=true/

I changed date to 

# date
Wed Mar 31 19:50:48 PDT 2010

Run the query: 
http://localhost:8983/solr/select/?q=last_update_date:[NOW/DAY-7DAYS%20TO%20NOW/HOUR-5HOURS]fl=last_update_datedebugQuery=true

I should not be getting the 3 entries below with last update date
2010-03-31T19:40:34Z. 

NOW/HOUR-5HOURS evaluates to 2010-03-31T21:00:00 which should not be the
case if the current time is Wed Mar 31 19:50:48 PDT 2010. Is SOLR converting
NOW to GMT time? 

Here is the result: 

response

lst name=responseHeader
int name=status0/int
int name=QTime2/int

lst name=params

str name=q
last_update_date:[NOW/DAY-7DAYS TO NOW/HOUR-5HOURS]
/str
str name=fllast_update_date/str
str name=debugQuerytrue/str
/lst
/lst

result name=response numFound=3 start=0

doc
date name=last_update_date2010-03-31T19:40:34Z/date
/doc

doc
date name=last_update_date2010-03-31T19:40:34Z/date
/doc

doc
date name=last_update_date2010-03-31T19:40:34Z/date
/doc
/result

lst name=debug

str name=rawquerystring
last_update_date:[NOW/DAY-7DAYS TO NOW/HOUR-5HOURS]
/str

str name=querystring
last_update_date:[NOW/DAY-7DAYS TO NOW/HOUR-5HOURS]
/str

str name=parsedquery
last_update_date:[2010-03-25T00:00:00Z TO 2010-03-31T21:00:00Z]
/str

str name=parsedquery_toString
last_update_date:[2010-03-25T00:00:00 TO 2010-03-31T21:00:00]
/str

lst name=explain

str name=id1

1.0 = (MATCH) ConstantScoreQuery(last_update_date:[2010-03-25T00:00:00 TO
2010-03-31T21:00:00]), product of:
  1.0 = boost
  1.0 = queryNorm
/str

str name=id2

1.0 = (MATCH) ConstantScoreQuery(last_update_date:[2010-03-25T00:00:00 TO
2010-03-31T21:00:00]), product of:
  1.0 = boost
  1.0 = queryNorm
/str

str name=id3

1.0 = (MATCH) ConstantScoreQuery(last_update_date:[2010-03-25T00:00:00 TO
2010-03-31T21:00:00]), product of:
  1.0 = boost
  1.0 = queryNorm
/str
/lst
str name=QParserLuceneQParser/str

lst name=timing
double name=time2.0/double

lst name=prepare
double name=time1.0/double

lst name=org.apache.solr.handler.component.QueryComponent
double name=time1.0/double
/lst

lst name=org.apache.solr.handler.component.FacetComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.MoreLikeThisComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.HighlightComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.StatsComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.DebugComponent
double name=time0.0/double
/lst
/lst

lst name=process
double name=time1.0/double

lst name=org.apache.solr.handler.component.QueryComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.FacetComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.MoreLikeThisComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.HighlightComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.StatsComponent
double name=time0.0/double
/lst

lst name=org.apache.solr.handler.component.DebugComponent
double name=time1.0/double
/lst
/lst
/lst
/lst
/response
-- 
View this message in context: 
http://n3.nabble.com/selecting-documents-older-than-4-hours-tp689975p695037.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: selecting documents older than 4 hours

2010-04-01 Thread Israel Ekpo
I did something similar.

The only difference with my set up is that I have two columns; one that
store the dates the document was first created and a second that stores the
date it was last updated as unix time stamps

So my query to find documents that are older than 4 hours would be very easy

To find documents that were last updated more than for hours ago you would
do something like this

q=last_update_date:[* TO 1270119278]

The current timestamp now is 1270133678. 4 hours ago was 1270119278

The column types in the schema is tint



On Wed, Mar 31, 2010 at 11:18 PM, herceg_novi herceg_n...@yahoo.com wrote:


 Hello, I'd like to select documents older than 4 hours in my Solr 1.4
 installation.

 The query

 q=last_update_date:[NOW-7DAYS TO NOW-4HOURS]

 does not return a correct recordset. I would expect to get all documents
 with last_update_date in the specified range. Instead solr returns all
 documents that exist in the index which is not what I would expect.
 Last_update_date is SolrDate field.

 This does not work either
 q=last_update_date:[NOW/DAY-7DAYS TO NOW/HOUR-4HOURS]

 This works, but I manually had to calculate the 4 hour difference and
 insert
 solr date formated timestamp into my query (I prefer not to do that)
 q=last_update_date:[NOW/DAY-7DAYS TO 2010-03-31T19:40:34Z]

 Any ideas if I can get this to work as expected?
 q=last_update_date:[NOW-7DAYS TO NOW-4HOURS]

 Thanks!
 --
 View this message in context:
 http://n3.nabble.com/selecting-documents-older-than-4-hours-tp689975p689975.html
 Sent from the Solr - User mailing list archive at Nabble.com.




-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/


Re: selecting documents older than 4 hours

2010-04-01 Thread Chris Hostetter

: q=last_update_date:[NOW-7DAYS TO NOW-4HOURS]
: 
: does not return a correct recordset. I would expect to get all documents
: with last_update_date in the specified range. Instead solr returns all
: documents that exist in the index which is not what I would expect.
: Last_update_date is SolrDate field. 

that query should work fine, and do exactly what you describe.

there is no field type named SolrDate in solr ... can you please past in 
the exact schema.xml entries for your last_update_date field, as well as 
for the fieldType assocaited with that field?

also: what does debugQuery=true show when you execute that query? (in 
particular i'd like to see the what the parsedquery information looks 
like)



-Hoss