I am facing an issue. I add a DateTime Picker property on a document type and is important to use this date in order to either sort or retrieve content. The problem is that umbraco indexes that field as text and either the sorting is not correct or when i need to retrieve content for the specific date or range of days the query is not working. How can i force umbraco to index the DateTime property as Long instead of text?
I know when you've asked this in the other thread (where I said to start your own question). you said you've followed the article I shared about Date indexing... Just wanted to check you've not skipped over the set of defining the field in the index have you?
What I would do is define the field with a different name to the property, and then use the TransformingValues event to update that field. That way you have 2 fields, 1 with the default indexed value and 1 with the custom value. That might help. I have seen some conflicts where you try and add/update a field the the same name.
Also, you HAVE to have the custom transforming values stuff else it won't be putting the right values into the field :-)
Hopefully that will help, else it will be a case of having to share some code to see what you are doing :-) As mentioned on the other thread, I'm available on Twitter https://twitter.com/HotChilliCode or on the Umbraco Slack (@nik)
I will send you the code to see it, i believe that i didn't loose anything, and if i cannot find a solution the i will probably try to add a queue sequence procedure in order to execute the rebuild async in background.
Examine indexes DateTime Picker as Text
I am facing an issue. I add a DateTime Picker property on a document type and is important to use this date in order to either sort or retrieve content. The problem is that umbraco indexes that field as text and either the sorting is not correct or when i need to retrieve content for the specific date or range of days the query is not working. How can i force umbraco to index the DateTime property as Long instead of text?
Hey Thomas,
I know when you've asked this in the other thread (where I said to start your own question). you said you've followed the article I shared about Date indexing... Just wanted to check you've not skipped over the set of defining the field in the index have you?
https://justnik.me/blog/indexing-sort-able-dates-in-umbraco-version-8#manipulating-the-data
What I would do is define the field with a different name to the property, and then use the TransformingValues event to update that field. That way you have 2 fields, 1 with the default indexed value and 1 with the custom value. That might help. I have seen some conflicts where you try and add/update a field the the same name.
Also, you HAVE to have the custom transforming values stuff else it won't be putting the right values into the field :-)
Hopefully that will help, else it will be a case of having to share some code to see what you are doing :-) As mentioned on the other thread, I'm available on Twitter https://twitter.com/HotChilliCode or on the Umbraco Slack (@nik)
Cheers
Nik
I will send you the code to see it, i believe that i didn't loose anything, and if i cannot find a solution the i will probably try to add a queue sequence procedure in order to execute the rebuild async in background.
I finally found the problem and now it works... Thanks a lot
is working on a reply...