cancel
Showing results for 
Search instead for 
Did you mean: 

How to do a FTS-ALFRESCO date query with a custom datatime?

spilby
Confirmed Champ
Confirmed Champ

Hi,

I'm using Alfresco 4.2.6 with SOLR.

I need to seach a custom property with a FTS-ALFRESCO query. This custom property is a datetime. This is how I define it on my xml model:

<namespaces>

<namespace uri="mydocument.model" prefix="doc" />

</namespaces>

<property name="doc:myDate" editVisible="true" createVisible="true" editable="true" inheritable="false" calculable="true">

                    <title>Data</title>

                    <type>d:datetime</type>

                    <mandatory>true</mandatory>

                    <index enabled="true">

                          <atomic>false</atomic>

                          <stored>false</stored>

                          <tokenised>false</tokenised>

                    </index>

                </property>

If I go to the node navigator of my share and search something like this:

(@cm\:created:["2016-01-07T00:00:00.000" TO "2016-10-05T23:59:59.000"])

the seach works and return me results. But if I try to use my custom property:

@doc\:myDate:["2016-01-07T00:00:00.000" TO "2016-10-05T23:59:59.000"]

returns me 0 results. I can see documents with my property correctly fulled:

doc:myDate

d:datetime

12 ene 2016 00:00:00 GMT+0100 (CET)

Exactly as the cm create date:

cm:created

d:datetime

12 ene 2016 15:57:17 GMT+0100 (CET)

And all my properties are indexed on SOLR, because I can find it with another query.

Where is the problem? Why that query don't return me results?

NOTE: I don't need to search with hours and minutes. Only with dates, if there are a response more simple.

Thanks! And best regards.

1 ACCEPTED ANSWER

redraccoon
Star Contributor
Star Contributor

Maybe it's this

Tokenised="true"If "true", the string value of the property is tokenized before indexing.if "false", it is indexed "as is" as a single string.if "both" then both forms above are in the index.

What I understood is that your Tokenised="false" stored your custom date as a String in your Alfresco, wich would explain why it wouldn't be able to compare your dates format

View answer in original post

2 REPLIES 2

redraccoon
Star Contributor
Star Contributor

Maybe it's this

Tokenised="true"If "true", the string value of the property is tokenized before indexing.if "false", it is indexed "as is" as a single string.if "both" then both forms above are in the index.

What I understood is that your Tokenised="false" stored your custom date as a String in your Alfresco, wich would explain why it wouldn't be able to compare your dates format

kaynezhang
World-Class Innovator
World-Class Innovator

Yes, you can  set  tokenised to both and rebuild the index.

      <tokenised>both</tokenised>