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>
FILES:   csv-09-09.csv
0 votes

1 answers

2669 views

ANSWER



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.

0 votes



Greg Drayon Thank you for reply, yes my created documents do have the right date since i've already changed dateFormat to (“dd/MM/yyyy”) in CSVImporterOptions.java , i've also tried adding quotes but still having the same problem. In the example above i'm getting result for "31/08/2015" and "11/06/2015" but not for "30/06/2015"
11/12/2015

Maybe the problem doesn't come from the CSVImporter. If I get it right, you have some kind of folder (which may or may not contain any document, it does not matter) with a contentView to display the result of a query? Can you give the query set up in the contentView, or run this query in the NXQL Search (for admin only)? Does it brings you the right results?
11/12/2015

Greg Drayon please can you see my update ? When running this query

SELECT * FROM accuse_de_reception WHERE adr:date_comptabilisation = DATE &apos;2015-06-30&apos; and ecm:mixinType != &apos;HiddenInNavigation&apos; AND ecm:isProxy = 0 AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != &apos;deleted&apos;

i could get the result

11/24/2015

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.
11/27/2015