Copied to clipboard

Flag this post as spam?

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


  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    Oct 28, 2017 @ 21:33
    Paul Seal
    0

    Backoffice Examine Lucene query date range question

    Backoffice Examine Lucene query question: In the backoffice > Developer tab > Examine settings > Internal Searcher > Lucene Search. If I want to get all documents created between two dates, what should I enter? Whatever I try doesn't work. Thanks in advance.

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Oct 30, 2017 @ 11:58
    Marc Goodson
    0

    Hi Paul

    Check your the System Fields in your Indexer on the dashboard to determine if createDate is set to be a DateTime type

    and then I think this should work:

    createDate:[20160101 TO 20170101]

    for returning all documents created between 1st Jan 2016 and 1st Jan 2017

    regards

    Marc

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    Oct 30, 2017 @ 12:01
    Paul Seal
    0

    Try it in this backoffice, yours didn't work. http://umbraco7.ucommerce.net/umbraco/

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    Oct 30, 2017 @ 12:06
    Paul Seal
    0

    Sorry yours did work, it was the dates that were out that's all. I've updated it.

    +createDate:[20170101 TO 20180101]
    

    Now I need to know how to do it on a user date field which is auto indexed in the internal index set.

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Oct 31, 2017 @ 10:58
    Marc Goodson
    0

    Hi Paul

    good to hear the suggestion resolves your original issue!

    but now a further issue? - eg you are not looking for items created between two dates, but items that have a specific custom date property in a certain range.

    It depends a little on how you have the configured custom property in your examine index config? eg is it specified as a DateTime, if so then I think you should just be able to update the above to use the alias of your custom property?

    myCustomDateAlias:[20170101 TO 20180101]

    ?

    regards

    Marc

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    Oct 31, 2017 @ 16:52
    Paul Seal
    0

    Thanks Marc

    Ideally I don't want to have to specify an Index Set. I would like to use the automatic indexing, but they are all set as strings by default.

    Do I need to specify an index set where I have my fields as dates in there?

    Should I create a separate Index set or should I just add my user defined fields to an existing index set, internal or external? If so which should I add it to?

    Thanks

    Paul

  • Brad McDavid 11 posts 123 karma points
    Oct 31, 2017 @ 19:34
    Brad McDavid
    0

    Hi Paul,

    I apologize for not having a full example, but you can use an ApplicationEventHandler to attach to DocumentWriting to insert new fields into the Lucene index.

    The relevant lines for you on this GitHub file are 51-57 to wire up the DocumentWriting event for all providers. Then 99-103 to insert a new custom DateTime field. And finally 109 to add the new custom field to the index, which you can then use to search on.

    The biggest downside with this approach is these fields don't show in the back-end as they don't exist in the config files.

    Hope this helps, Brad

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    Oct 31, 2017 @ 19:40
    Paul Seal
    0

    That's great Brad, thank you. I'll give this a try.

Please Sign in or register to post replies

Write your reply to:

Draft