This question about Topic Markup Language and applications: Answered
How to link to attachment of a topic using Search
We are trying to develop a application on foswiki where
- We will attach a document which needs to be searched to a topic
- We have created a data form which will be attached to the topic which stores the structured data for searching the document
- There will be search page where user will put options which will be selected by users and the info will be passed to search
- Search will search all documents with the form and then search within the fields.
I was able to workout the above using the documentation. where i am stuck is the following
Preferably i would like the user to click on the search results to open the attachment. How do I write a generic syntax in format field of Search so that it returns refernce to attachment irrespective of attachment name.
To clarify
1. I have topic SWP1426 to which data form (
DolSchemeForm) is attached. This form has form field
TypeOfOlr set to MN Overload relays . Attachment ECT162.PDF is also attached to this topic.
2. I have a search topic which has following syntax below so that the page shows a link with topic name (SWP1462). When clicked the link opens the file ECT162.PDF directly.
%SEARCH{
type="query"
"form.name = 'DolSchemeForm' AND TypeOfOLR ~ 'MN*' "
nonoise="on"
format=" [[%PUBURL%/$web/$topic/ECT162.pdf][$topic]]" }%
3. Typically the attachments will be loaded by different users hence the name of attachments will be different. how can i modify the format line so that it links to attachement of the search result topic w/o knowling the name of attachemnt in advance.
--
HarshadDivekar - 11 May 2011
AFAIK you won't be able to extract the attachment name using a standard (query) search but it should be possible using
AttachmentListPlugin.
--
MartinKaufmann - 12 May 2011