Date and catalog

9 Messages Forum Options Options
Embed this topic
Permalink
Chauvet Etienne | ARTIFICA-2
Date and catalog
Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
 
In a python script i 've
 
REQUEST=context.REQUEST
d1 = REQUEST.get('date1', '')
d2 = REQUEST.get('date2', '')
 
d1= d1[6:10]+'/'+d1[3:5]+'/'+d1[0:2]+' 00:00:00'
d2= d2[6:10]+'/'+d2[3:5]+'/'+d2[0:2]+' 00:00:00'
 
query = {'portal_type' : 'Publication',
         'review_state' : 'published',
         }
 
query['Date'] = {
             'query': [d1, d2],
             'range': 'minmax'}
 
return context.portal_catalog.searchResults(query)
 
 
But the result it's not what i want...
Andreas Jung
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink


--On 17. Januar 2006 11:01:59 +0100 Chauvet Etienne | ARTIFICA
<etienne.chauvet@...> wrote:

>
> query['Date'] = {
>              'query': [d1, d2],
>              'range': 'minmax'}


Why should that work? A DateIndex indexes DateTime instances and _not_
dates represented as some sort of string. You _must_ use DateTime instance
as 'query' parameters, not strings.

-aj




attachment0 (193 bytes) Download Attachment
Chauvet Etienne | ARTIFICA
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I don't understand.
 
Id i do :
 
REQUEST=context.REQUEST
d1 = REQUEST.get('date1', '')
d2 = REQUEST.get('date2', '')
 

d1= DateTime(d1)
d2= DateTime(d2)
 
query = {'portal_type' : 'Publication',
         'review_state' : 'published',
         }
 
query['Date'] = {
             'query': [d1, d2],
             'range': 'minmax'}
 
return context.portal_catalog.searchResults(query)
 
It doesn't work.
Andreas Jung
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink


--On 17. Januar 2006 11:15:19 +0100 Chauvet Etienne | ARTIFICA
<etienne@...> wrote:

> I don't understand.
>
> Id i do :
>
> REQUEST=context.REQUEST
> d1 = REQUEST.get('date1', '')
> d2 = REQUEST.get('date2', '')
>
>
> d1= DateTime(d1)
> d2= DateTime(d2)
>
> query = {'portal_type' : 'Publication',
>          'review_state' : 'published',
>          }
>
> query['Date'] = {
>              'query': [d1, d2],
>              'range': 'minmax'}
>
> return context.portal_catalog.searchResults(query)
>
+

This is supposed to work as long as 'd1' and 'd2' can be parsed properly.
If not, provide a reasonable and reproduceable testcase.

-aj



attachment0 (193 bytes) Download Attachment
Chauvet Etienne | ARTIFICA
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink
But it doesn't.

In metadata content, i' ve  
- date 2006/01/09 14:30:00 GMT+1

In index content, i' ve  
-  1074632490


In the form,
d1 = 16/01/2006
d2 = 20/01/2006

and i get the object with the criteria above


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Andreas Jung
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink


--On 17. Januar 2006 11:28:06 +0100 Chauvet Etienne | ARTIFICA
<etienne@...> wrote:

> But it doesn't.
>
> In metadata content, i' ve  - date 2006/01/09 14:30:00 GMT+1
>
> In index content, i' ve  -  1074632490
>
>
> In the form, d1 = 16/01/2006
> d2 = 20/01/2006
>
> and i get the object with the criteria above
>
Try YYYY/MM/DD


-aj



attachment0 (193 bytes) Download Attachment
Chauvet Etienne | ARTIFICA-2
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
i've in the form
d1 = 2006/01/01
d2 = 2006/01/08
 
the result is :
 
Andreas Jung
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink


--On 17. Januar 2006 11:41:54 +0100 Chauvet Etienne | ARTIFICA
<etienne.chauvet@...> wrote:

> i've in the form
> d1 = 2006/01/01
> d2 = 2006/01/08
>
> the result is :
>
>   a.. 2006/01/09 14:35:00 GMT+1
>   b.. 2002/01/12 14:35:00 GMT+1
>   c.. 2004/01/12 14:35:00 GMT+1
>   d.. 2004/01/12 14:35:00 GMT+1
>   e.. 2006/01/09 14:30:00 GMT+1
and?





attachment0 (193 bytes) Download Attachment
Pawel Lewicki
Re: Date and catalog
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by Chauvet Etienne | ARTIFICA-2
Chauvet Etienne | ARTIFICA napisaƂ(a):

> i've in the form
> d1 = 2006/01/01
> d2 = 2006/01/08
>  
> the result is :
>  
>
>     * 2006/01/09 14:35:00 GMT+1
>       <http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Constitutive
>       expression of MHC>
>     * 2002/01/12 14:35:00 GMT+1
>       <http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Isoforms_of_the_Class_II_Transactivator_Protein>
>     * 2004/01/12 14:35:00 GMT+1
>       <http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Defective-Class-II-Transactivator-expression>
>     * 2004/01/12 14:35:00 GMT+1
>       <http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/HLA-DR-signaling-inhibits-Fas-mediated-apoptosis-in-melanoma-cells>
>     * 2006/01/09 14:30:00 GMT+1
>       <http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Uncoordinated_HLA-D_gene_expression>

You write nothing about your Publication type. Is it indexed properly?
'Date' index has nothing to do with your 'date' field. Compare
http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Defective-Class-II-Transactivator-expression/Date
with
http://ijm.artifica.fr:8080/ijm/recherche/Production_scientifique/Defective-Class-II-Transactivator-expression/getDate

Pawel



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users