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.
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?
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?
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.
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.
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
Try it in this backoffice, yours didn't work. http://umbraco7.ucommerce.net/umbraco/
Sorry yours did work, it was the dates that were out that's all. I've updated it.
Now I need to know how to do it on a user date field which is auto indexed in the internal index set.
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
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
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
That's great Brad, thank you. I'll give this a try.
is working on a reply...