Search a date range

Question: is there a simple way to set up a search between a date range? For example, to see everything between two distinct dates (year - month - day)?

If not, how difficult would this be to set up on the Advanced Search page?

1 Like

I don’t think there’s a simple way. One of the Neatline plugins can do it, but I don’t know exactly how they got it to work, and the SQL query and interface seem fairly complicated (sufficiently so that I’m not really sure where I’d start).

I was going to ask same thing. There is an ID range search, but the syntax and method implementation of Omeka_Db_Table::filterByRange() doesn’t allow simple re-usability for other than numeric values. I was looking on other websites (GitHub, Google) how did they handle range searches and most common syntax seems to be .. (double full stop).
So I wonder if you think it’s good idea to rewrite current Omeka_Db_Table::filterByRange() into using .. as range separator, and maybe even support open start/end values?
Examples:

  • 2015-10..2017-10 would produce WHERE col BETWEEN '2015-10' AND '2017-10'
  • ..2017-10 would produce WHERE col<='2017-10'
  • 2015-10.. would produce WHERE col>='2015-10'

I’m aware that lot of people are already used to range search using hyphen -, so I’m not sure this core change is welcome by all, but the date range search is fundamental.
Or do you have some other suggestions about syntax or implementation?

2 Likes

Can you point to website where this plugin is working?

Has there been any further advancement with this?

1 Like

No, I didn’t make into PR on Github, because I got no feedback. Currently, the easiest solution is to build this in plugin and inject advanced search form with custom criteria for date search that will support the range with other char than hyphen.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.