Hi Omar & Ben, The DSpace 7 REST API can support Solr/Lucene style queries, provided that it's URL encoded. So, this sort of search by lastModified date is already supported for Items as the lastModified date of an Item is indexed in Solr (as the Solr field "lastModified"), see: https://github.com/DSpace/DSpace/blob/main/dspace-api/src/main/java/org/dspace/discovery/indexobject/ItemIndexFactoryImpl.java#L141
The syntax is a bit odd, as you must both use a Solr date range search & ensure it is URL encoded. * Solr date range query syntax: https://solr.apache.org/guide/8_0/working-with-dates.html * YOU MUST URL encode special characters in this syntax, e.g. the square brackets [] and any other special characters, etc. But, once you do all that, it works. Here's an example using the demo REST API: https://api7.dspace.org/server/api/discover/search/objects?query=lastModified%3A%5B2021-01-01T00:00:00Z%20TO%202021-09-01T00:00:00Z%5D That's hard to read, but un-encoded it says: "query=lastModified:[2021-01-01T00:00:00Z TO 2021-09-01T00:00:00Z]" In other words, everything modified between Jan 1 and Sept 1 of this year. I'll admit, I cannot guarantee this will work perfectly for all Solr date queries (e.g. I'm having difficulty getting it to work locally for an open-ended query using an asterisk), but the basics do work. (NOTE: This only works for Items, as currently DSpace doesn't support a "lastModified" date concept for Communities or Collections, etc.) Tim ________________________________ From: 'Ben Heartland' via DSpace Technical Support <[email protected]> Sent: Tuesday, September 21, 2021 4:48 AM To: DSpace Technical Support <[email protected]> Subject: [dspace-tech] Re: DSpace 7 API search by lastModified date Hi, Thanks for raising this Omar, this would be a welcome addition for us too. Currently, we first use OAI to find recently changed items, then use the 6.x REST API to get their metadata. Having both operations consolidated under the new core API would be simpler and more robust. All the best, Ben On Monday, 20 September 2021 at 01:09:50 UTC+1 [email protected] wrote: Hi, I want to know if using the new DSpace 7 API there is a way to perform a search to get only those records that have been created and / or updated from a certain date, I see among the information obtained with the API (endpoint /api/core/items) that there is the "lastModified" field which is useful to know this, but I would like to filter it without having to get all the items first, the closest I have found is that I can do a search using the metadata dc.date.issued something like: /api/discover/search/objects?f.dateIssued=%5B2019 TO 2021%5D,equals But I would rather like a result like the one obtained with OIA using a query like the following: https://example.com/oai/request?verb=ListRecords&metadataPrefix=oai_dc&from=2019-08-01&until=2021-09-15 Thanks, Omar -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/f1a49926-57cb-43c0-b8cb-21f3b516492dn%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/f1a49926-57cb-43c0-b8cb-21f3b516492dn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/DM5PR2201MB114820A5E19E311854E4D449EDA29%40DM5PR2201MB1148.namprd22.prod.outlook.com.
