EARLIER_THAN, LATER_THAN and WITHIN_DAYS must be dates in the format expected by Time::ParseDate (like the ActionTrackerPlugin?). WITHIN_DAYS works out the number of working days (i.e. excluding Saturday and Sunday). Apologies in advance if your weekend is offset ± a day!
A search object implements the "matches" method as its general
contract with the rest of the world.
ExampleGet a list of attachments that have a date earlier than 1st January 2000
$db = new TWiki::Contrib::DBCacheContrib::DBCache( $web ); # always done
$db->load();
my $search = new TWiki::Contrib::DBCacheContrib::Search("date EARLIER_THAN '1st January 2000'");
foreach my $topic ($db->getKeys()) {
my $attachments = $topic->get("attachments");
foreach my $val ($attachments->getValues()) {
if ($search->matches($val)) {
print $val->get("name") . "\n";
}
}
}
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Author: | TWiki:Main/CrawfordCurrie | |||||||||
| Copyright ©: | This code is based on an original development of Motorola Inc. and is protected by the following copyrights: Copyright @copy 2002-2003 Motorola Inc. All Rights Reserved. Portions copyright © 2004. Crawford Currie http://www.c-dot.co.uk | |||||||||
| License: | As required for the publication of all extensions to TWiki, this software is published under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details, published at http://www.gnu.org/copyleft/gpl.html | |||||||||
| Version: | 11537 | |||||||||
| Change History: | ||||||||||
| 11537 | Added lc and uc operators for case-insensitive searches | |||||||||
| 9303 | don't die on broken symlinks | |||||||||
| 8682 | Item1580 one-char fix that makes the difference | |||||||||
| 8110 | Item663 formatting and text fixes | |||||||||
| 7552 | Item997 test update | |||||||||
| 7274 | Item719 onReload() is not a static method. | |||||||||
| 7262 | Item719 MichaelDaum?'s patch (almost) to correct parameters to onReload | |||||||||
| 7260 | Item727 made it clean the form name using normaliseWebTopicName | |||||||||
| 6353 | Item380 do as the man says; make all $/ local | |||||||||
| 5720 | Updated tests | |||||||||
| 5719 | Fix for correct handling of parent relations | |||||||||
| 5229 | Small improvement to the way it handles errors from Storable and Archive | |||||||||
| 5223 | Documentation fixes, adding gifs. | |||||||||
| 5048 | Cairo readiness | |||||||||
| 5036 | Split from SharedCode? | |||||||||
| 5031 | Moving to new name | |||||||||
| 5030 | About to rename | |||||||||
| 5019 | Improved topic data model, cleaned up tests | |||||||||
| 5008 | Added extended access syntax, [?], [*] etc. | |||||||||
| 5006 | Doc fixes | |||||||||
| 5005 | Poddified documentation | |||||||||
| 5003 | Initial version | |||||||||
| 8 Jul 2004 | Initial version, split out from FormQueryPlugin? | |||||||||
| Dependencies: |
| |||||||||
| Perl Version: | 5.0 | |||||||||
| Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/DBCacheContrib | |||||||||
| Feedback: | http://TWiki.org/cgi-bin/view/Plugins/DBCacheContribDev | |||||||||
| Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/DBCacheContribAppraisal |