SID-00287: Nested search question with SEARCH and TAGME
| Status: |
Unanswered |
TWiki version: |
4.3.0 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
|
Last update: |
16 years ago |
Hi. For details, see
LesLaCroixSandbox at twiki.org.
I have a search that is returning a set of topics. The output format is a table, and I would like one of the columns to be the tags associated with the topic.
So, I have a TAGME "showalltags" in the format="" parameter of the SEARCH. I have escaped it with $percnt and escaped the quotes with backslashes per the examples in
FormattedSearch as well as in the numerous answers to questions in the support web. What is output to the browser is the TAGME string, with its percents and quotes in all the right places, but uninterpreted.
I have successfully nested a SEARCH within another SEARCH, and have tried all of the tricks I can think of to nest the TAGME but with no luck. It's probably something really easy, but I've spent hours banging my head on this.
I have reproduced the issue in my sandbox topic here at twiki.org (see above for link), so I don't think it's a function of my TWiki rev (which is 4.2.x). The link is above.
Any help would be appreciated. Thanks! -Les
--
LesLaCroix - 2009-04-28
Discussion and Answer
You are only using the TAGME query to get topics with the desired tags...
%TAGME{tpaction="query" tag="tagging" by="%URLPARAM{by}%" norelated="on" nototal="on" separator="," format="$topic"}% ...does this:
TagMePlugin,TagMePlugin,TagMePluginDev,TagCloudPlugin,TagMeDiscussions,Folksonomy,TagMePlugin,FolksonomiesClassification,TagCloud,BlogUp,UseTaggingInsteadOfInterestedParties
But you can add
topic="*Sandbox*" and it will do the SEARCH as part of the TAGME query (let's search for '*Cr*' instead so that there are multiple hits):
__Note:__ No topics found tagged with "tagging"
Then format the result to showall tags:
Note: No topics found tagged with "tagging"
With your original layout, I can't tell what the order of operations was, so I couldn't fix it: TAGME query, then SEARCH, then de-escape the TAGME showalltags?... or was it trying to SEARCH, the de-escape the showalltags then do the TAGME query?...
But this way, it's unambiguous: TAGME query, then execute showalltags on each query result. Short and sweet!
--
SeanCMorgan - 2009-04-28
Sorry about the ambiguity. It arose because I was trying to reduce the complexity to make things more clear. Oh well!
The actual search I am attempting is part of a customized search page for my application and looks more like this:
%SEARCH{
"(lc(Department) ~ lc('*%URLPARAM{...}%*')) AND (Status ~ '%URLPARAM{...}%')"
type="query"
topic="%TAGME{ tpaction="query" tag="%URLPARAM{...}%" format="$topic" ... }%"
header="| *Topic* | *Department* | *Status* | *Tags* |"
format="| $topic | $formfield(Department) | $formfield(Status) | ??? |"
}%
(Department and Status are form fields.)
The point of the search is to return topics where the tag, department and status are coming in from an input form. The Department search is coming from a text field, and the search needs to be case-insensitive and a "contains" sort of search, hence the wildcards. The status is coming from a selector input object that I control the values of, so there's no need to use wildcards or downcase everything.
The search is working just fine: exactly the topics I am expecting are being returned. I am stumped, though, at what to put in for the "???" in order to get the tags for the $topic. The examples of what I've tried are in
my sandbox.
--
LesLaCroix - 2009-04-29
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2009-06-02
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.