That clarifies things, thanx.

Florent Guillaume wrote:
Hi Vincent.

Actually talking about DATE was a mistake on my part, because it doesn't clarify things. Internally, in the JCR, dates are always stored as full timestamps. There is not datatype for DATE inside the storage.

The DATE syntax is just a shortcut to express an hour/minute/second of 0:0:0 and is just a shortcut in the query parsing, but comparing dates by equality in the JCR cannot work with this method. So you should always use TIMESTAMP. It's always a TIMESTAMP that's passed to JCR under the hood.

Florent

On 16 Mar 2007, at 11:31, Vincent Dutat wrote:

Hi,

NXQL syntax with works fine with '>= DATE ' but does NOT with '= DATE '. What I want is select documents created on ONE specific day and NOT documents created since that specific day. I found a workaround by using '>= TIMESTAMP 2007-01-01 00:00:00 AND dc:created <= TIMESTAMP 2007-01-01 23:59:59' but it's a bit ugly ;-)


Florent Guillaume wrote:
No, the fix was done later than the tagging of 5.1-M1, so you'll have to use the trunk. Or maybe just fetch org.nuxeo.ecm.core.query and org.nuxeo.ecm.core.jcr-connector, which were the two packages impacted.
Florent
On 4 Mar 2007, at 18:10, Vincent Dutat wrote:
Hi,

will the fix be available in tag 5.1-M1 or only in trunk ?


Florent Guillaume wrote:
It's now fixed.
Note that the syntax follows SQL92 here, you have to say:
SELECT * FROM document WHERE dc:created >= DATE '2007-01-01'
or
SELECT * FROM document WHERE dc:created >= TIMESTAMP '2007-01-01 12:30:00+03:00'
for instance.
Florent
On 2 Mar 2007, at 20:14, Vincent Dutat wrote:
Ok, thanks.

Florent Guillaume wrote:
Ok but there really is a bug on our side, I'm fixing it now.
I'll keep you posted.
Florent
On 2 Mar 2007, at 17:34, Florent Guillaume wrote:
Ah yes, the format that Jackrabbit accepts is very strict, see
http://jackrabbit.apache.org/api-1/org/apache/jackrabbit/util/ISO8601.html
You'll have to use for example:
  2007-01-31T12:00:00.000+01:00

Florent

On 2 Mar 2007, at 16:38, Vincent Dutat wrote:

Hi,

I tried already to give the date in the ISO form like "2007-01-31" but it does not work, neither "2007-01-31 12:00:00". Here is the Lucene warning extracted from server.log:

2007-03-02 16:33:30,766 DEBUG [org.nuxeo.ecm.webapp.search.SearchBusinessDelegate] <searchWithNXQL> NXQL: SELECT * FROM NoteDeService WHERE ns:date_publication = "2007-07-02 12:00:00"

2007-03-02 16:33:30,766 DEBUG [org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor

2007-03-02 16:33:31,501 WARN [org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder] Unable to coerce '2007-07-02 12:00:00' into a DATE.

2007-03-02 16:33:31,595 DEBUG [org.nuxeo.ecm.webapp.search.SearchBusinessDelegate] <searchWithNXQL> results contains 0 docs



Florent Guillaume wrote:
Ok I didn't find any bug in our code. The dates are passed as strings directly to the backend that interprets it. It must mean that when you generate the SQL expression you generate dates like "04/07/2002" which are incorrect (or at least confusing because locale-dependent), the only format supported everywhere with certainty is the ISO one, like "2007-02-20 12:00:00". So you should generate your NXQL queries with this format.
Florent
On 1 Mar 2007, at 20:35, Vincent Dutat wrote:
Hi, I got the following warning :
2007-03-01 20:32:48,703 WARN [org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder] Unable to coerce '04/07/2002' into a DATE.



Florent Guillaume wrote:
Hi Vincent,
Could you check in the logs what query is executed? For instance (here for a full-text query): 2007-02-28 18:50:03,312 INFO [org.nuxeo.ecm.core.jcr.JCRQuery] execute XPath query: //element(*, ecmnt:document)[jcr:contains(.,'*toto*')] It's possible that there is a bug in the NXQL -> JCR conversion...
Also, what unwanted results do you get?
Florent
On 28 Feb 2007, at 11:27, Vincent Dutat wrote:
Hi,

I am having problems with NXQL when query contains a where-clause with a date. It looks like the '=' does not work. For example, I created a document on Feb 20 2007 and the following query does not work :
SELECT * FROM document WHERE dc:created = "2007-02-20"
But the following one works but it also gives me unwanted results :
SELECT * FROM document WHERE dc:created >= "2007-02-20"
--Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm


--Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to