Feature Proposal: Enhance SEARCH to allow searching by create date
Motivation
There is already an option to search by date (which was discussed in
SearchByDate before added to TWiki), but this allows only to search by modified date - read: the date of the last revision. I'm looking for an option to search for a/the
create date timespan. I will give one of many possible scenarios which is not possible without such a create date search feature.
- The Scenario:
- You want to traverse some pages by their create date, e.g. News Entries or Todo tasks. You could place a search on this site which searches the "next" entry by searching for all entries created later ($now/P50y excluding itself), ordering them by create date (which is already possible with order="created") and reducing the result to one (limit="1"). Analogous you can search for a "previously" created entry.
What do you think?
To clarify it and say it in other words. You can sort your search results by create date already, but at the moment you
can not search for a specific create date.
Description and Documentation
Request of a SEARCH enhancement to allow searching by
create date.
The Syntax for the date specification should be the same as described in
SearchByDate.
Examples
To search for all pages with begin with "NewsEntry" and are created in the year 2005, wether they are edited later in 2006 or not:
%SEARCH{"NewsEntry.*" type="regex" scope="topic" createdate="2003"}%
This fit well into existing syntax and features of SEARCH but make SEARCH more feature complete (in terms of consistent).
Impact and Available Solutions
Implementation
Please see the attached patch:
twiki-4.0.1-search-by-createdate.patch and
Bugs:Item2000
.
--
Contributors: TobiasRoeser
Discussion
--
TobiasRoeser - 28 Mar 2006
Ok, I created a
patch against TWiki-4.0.1 and opened an bug report as
Bugs:Item2000
.
Please comment here or there. I'm using this on my site, so it works, but please test yourself before using on a production system!
--
TobiasRoeser - 31 Mar 2006
Hmmm, createdate is working, but I'm still not able to do what I want. Now, I determined, that
REVINFO is not able to provide a date string with the right format to use in
TimeInterval. So, time for the next patch/enhancement.
Maybe, I/we need a Plugin, that provide just regex processing to the page author? I have to investigate the
SpreadSheetPlugin a second time...
--
TobiasRoeser - 31 Mar 2006
I now fond a solution to implement some kind of navigation bar to walk through pages based on creating dates.
The following example shows how to traverse through all pages with the prefix "News-". This Example assumes, that a createdate capable SEARCH version is available - see
Bugs:Item2000
or just apply the patch mentioned above.
<!-- the create date of the page -->
%CALC{"$SET( tmp_time, $TIME(%REVINFO{"$time" topic="%BASETOPIC%" rev="1.1"}%) )"}%
<!-- the date formated for use with TWiki.TimeInterval -->
%CALC{"$SET( my_time, $FORMATTIME( $GET( tmp_time ), $year-$month-$dayT$hour:$minute:$seconds ) )"}%
<!-- same as above with workaround for previous page -->
%CALC{"$SET( my_time2, $FORMATTIME( $EVAL( $GET( tmp_time ) - 3600 ), $year-$month-$dayT$hour:$minute:$seconds ) )"}%
<!-- Link to the next newer pages -->
%SEARCH{"News-" scope="topic" nosearch="on" createdate="%CALC{"$GET( my_time )"}%/P10y" order="created" limit="1" nototal="on" noheader="on" format="[[$web.$topic][<< Newer $topic]]"}%
<!-- Link to the next older page. -->
%SEARCH{"News-" scope="topic" nosearch="on" createdate="P10y/%CALC{"$GET( my_time2 )"}%" order="created" reverse="on" limit="1" nototal="on" noheader="on" format="[[$web.$topic][Older >> $topic]]"}%
I got some strange behavior with is may be related to
TimeInterval. The second search gives not the next page but the identical which makes the Link useless.

One workaround is to substract one hour (1 or 10 minutes didn't work), which work for me except for the first newest page.
Any help and tests welcome.
--
TobiasRoeser - 01 Apr 2006
Could please some one (of the core devs) comment on this page and
Bugs:Item2000
too?
Is no one interested in such feature? Are there not enought resources to test? Is the patch bad? Is it the wrong time to post enhancement, as we are trying to consolidate and speedup
TWikiVariables?
Please no longer ignore Bug reports and reporters, or the community will go away. If no one need this nor likes this nor want this, please tell this to the contributor/bug reporter (in this case me). No feedback means or can be understand as:
What do you want here? Go away and look for another OSS project, we don't like your contributions?
--
TobiasRoeser - 06 Apr 2006
The patch for the documentation is attached as:
TWiki-4.0.x-search-by-createdate-doc.patch
--
TobiasRoeser - 22 Apr 2006