Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas 160 posts 335 karma points
    Dec 15, 2020 @ 09:57
    Thomas
    0

    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?

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Dec 15, 2020 @ 10:38
    Nik
    100

    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

  • Thomas 160 posts 335 karma points
    Dec 15, 2020 @ 10:44
    Thomas
    0

    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.

  • Thomas 160 posts 335 karma points
    Dec 16, 2020 @ 07:57
    Thomas
    0

    I finally found the problem and now it works... Thanks a lot

Please Sign in or register to post replies

Write your reply to:

Draft