problem with date search
I've imported some data using CSV import, configured folder to search for specific metadata using Administration -> Local configuration -> Document content configuration , so when filtering date, sometimes it gives results sometimes not. I've attached the document i'm using to import data. Please note that i'm using french date format. Does anyone faced this problem ? Are there a solution ?
Update
This is the code i'm using for search
<contentView name="parent_accuse_de_reception_content">
<title>label.contentview.accuse_de_receptions_content</title>
<translateTitle>true</translateTitle>
<showTitle>false</showTitle>
<coreQueryPageProvider>
<property name="coreSession">#{documentManager}</property>
<property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
<whereClause docType="accuse_de_reception_search">
<predicate parameter="adr:num_facture" operator="ILIKE">
<field schema="accuse_de_reception_search" name="num_facture" />
</predicate>
<predicate parameter="bcbase:num_bc" operator="ILIKE">
<field schema="bc_base" name="num_bc" />
</predicate>
<predicate parameter="adr:date_comptabilisation" operator="=">
<field schema="accuse_de_reception_search" name="date_comptabilisation" />
</predicate>
<predicate parameter="adr:date_echeance" operator="=">
<field schema="accuse_de_reception_search" name="date_echeance" />
</predicate>
<predicate parameter="adr:client" operator="ILIKE">
<field schema="accuse_de_reception_search" name="client" />
</predicate>
<predicate parameter="adr:ville" operator="ILIKE">
<field schema="accuse_de_reception_search" name="ville" />
</predicate>
<predicate parameter="adr:montant" operator="=">
<field schema="accuse_de_reception_search" name="montant" />
</predicate>
<predicate parameter="adr:code_article" operator="ILIKE">
<field schema="accuse_de_reception_search" name="code_article" />
</predicate>
<fixedPart>
ecm:isCheckedInVersion = 0 AND
ecm:mixinType != 'HiddenInNavigation' AND
ecm:currentLifeCycleState != 'deleted' AND ecm:parentId = ? AND
ecm:primaryType = 'accuse_de_reception'
</fixedPart>
<sort column="dc:title" ascending="true" />
</whereClause>
<parameter>#{currentDocument.id}</parameter>
<pageSize>20</pageSize>
</coreQueryPageProvider>
<showPageSizeSelector>true</showPageSizeSelector>
<useGlobalPageSize>false</useGlobalPageSize>
<refresh>
<event>documentChanged</event>
<event>documentChildrenChanged</event>
</refresh>
<cacheKey>#{currentDocument.repositoryName}_#{currentDocument.id}</cacheKey>
<cacheSize>10</cacheSize>
<searchLayout name="accuse_de_reception_filter" filterDisplayType="quick" />
<showFilterForm>true</showFilterForm>
<resultLayouts>
<layout name="accuse_de_reception_listing_ajax" title="document_listing"
translateTitle="true" iconPath="/icons/document_listing_icon.png"
showCSVExport="true" showPDFExport="false" showEditColumns="true"
showSyndicationLinks="true" />
<layout iconPath="/icons/document_listing_icon_2_columns_icon.png"
name="document_listing_thumbnail" showEditRows="true"
showSpreadsheet="true" title="document_thumbnail_listing"
translateTitle="true" />
</resultLayouts>
<selectionList>CURRENT_SELECTION</selectionList>
<actions category="CURRENT_SELECTION_LIST" />
</contentView>
You create documents using the CSV import, then you try filtering them. When it does not work, have your created documents the right date for the “adr:date_comptabilisation” and/or “adr:date_echeance” metadata? Also, looking at this page: https://github.com/nuxeo/nuxeo-csv/blob/master/src/test/resources/docs_ok.csv, I see that the dates columns do have quotes, whereas your example doesn't have quotes surrounding the dates. BUT the page does not use the French date format. So as you have csv, can you create/generate it with another date format?
If you can't, I guess you use the CSV Importer nearly the way it is used here: https://github.com/nuxeo/nuxeo-csv/blob/master/src/test/java/org/nuxeo/ecm/csv/TestCSVImport.java
I see this at lines 93-96:
CSVImporterOptions options = CSVImporterOptions.DEFAULT_OPTIONS; TransactionHelper.commitOrRollbackTransaction(); String importId = csvImporter.launchImport(session, "/", getCSVFile(DOCS_OK_CSV), DOCS_OK_CSV, options);
In the CSVImporterOptions class (https://github.com/nuxeo/nuxeo-csv/blob/master/src/main/java/org/nuxeo/ecm/csv/CSVImporterOptions.java), there is a “dateFormat” attribute. Maybe you can create your own options class with the right dateFormat (“dd/MM/yyyy”)?
I hope this helps.
SELECT * FROM accuse_de_reception WHERE adr:date_comptabilisation = DATE '2015-06-30' and ecm:mixinType != 'HiddenInNavigation' AND ecm:isProxy = 0 AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'deleted'
i could get the result
The query you run seems different from the one run by the contentView. I would enable the logs for the ``` org.nuxeo.ecm.core.query
category, in the log4j.xml file, to see what is exactly the query run by the contentView. It should appear at the end of the server.log file when you access the folder using the contentView.