Feature Proposal: add topic="" to META and $attachment() to SEARCH format
Motivation
an irc conv, that shows a missing functionality ....
<TWikiGuest> Hi all, I'm strugling with TWiki search to give all the files that from all topics. In all my attempts only the topics come out from the search, but I need the files attached in %META:FILEATTACHMENT{...}.
<TWikiGuest> Here's what I tried: "%SEARCH{ "%META\:FILEATTACHMENT" topic="Item*" type="regex" format="$topic" nosearch="on" noheader="on" nosummary="on" }%
<TWikiGuest> the objective is to list all the file names in the attachments table of the topics whose name begin with "Item"
<TWikiGuest> However, what are get are the topics names rather than the file names mentioned in the attachment="..." of "%META:FILEATTACHMENT". Please help as I'm new in Twiki...
<TWikiGuest> my Twiki is 4.1
<Sven_Dowideit> TWikiGuest, what you need to do, is use some more magic
<Sven_Dowideit> mmm,
<Sven_Dowideit> gotta go look up the manual,
<Sven_Dowideit> see TWiki/TWikiVariables#META_displays_meta_data
<Sven_Dowideit> ie, change the SEARCH's output format from displaying $topic, which is the topic name
<Sven_Dowideit> to format="$percntMETA{$quotattachments$quot}$percnt"
<Sven_Dowideit> (the $quot and $percnt cause the evaluation of the %META to be delayed until after the evaluation of the SEARCH
<TWikiGuest> So, according to what you say, my statement becomes %SEARCH{ "%META\:FILEATTACHMENT" topic="Item*" type="regex" format="$percntMETA{$quotattachments$quot}$percnt" nosearch="on" noheader="on" nosummary="on" }%
There are 2 options, both should be considered together as they round out the existing syntax.
-
META{}
- add a topic specifier
META{topic="" ""}
- add a format specifier
META{topic="" format=""} instead of the default param that does not seem to allow customisation of output
-
SEARCH{"" format="$attachment(filename)"}% or similar, using a syntax that is consistent with query search.
Description and Documentation
Description of what this feature should do
Examples
Impact
Implementation
--
Contributors: SvenDowideit - 14 Mar 2008
Discussion
AttachmentListPlugin fills this hole, but this functionality should be in the core syntax.
--
SvenDowideit - 14 Mar 2008
It seems to me that the $attachment enhancement to the SEARCH format eliminates yet another reason to use regex search in meta so that the user can use the more powerful query search also for this. Makes sense to me.
--
KennethLavrsen - 15 Mar 2008
Me too, though I'd like to see the precise details of the syntax. From experience with the query search, it's tricky to get right.
--
CrawfordCurrie - 15 Mar 2008
DBCachePlugin also provides this functionality and, from my experience working with it, the syntax is pretty workable. Provides a good example to work off of at the least.
It was kind of shocking to me when I first realized that TWiki core provide NO method to generate a list of all attachments within a particular web. This should definitely be part of the core!
--
LynnwoodBrown - 16 Mar 2008
Agreed, formatting of attachment data should be available in the core code. I'd like to see a solid spec before we implement this feature.
I find the METASEARCH high up on the nerdometer, I feel we should jut extend SEARCH in a consistent way. E.g. do not implement
SimpleFieldQueriesInMETASEARCH.
See almost identical feature request
AddAttachmentsVarToFormattedSearch.
--
PeterThoeny - 16 Mar 2008
moved proposal to
AddAttachmentsVarToFormattedSearch.
--
SvenDowideit - 18 Mar 2008