This question about Topic Markup Language and applications: Answered

Query search text escapes

How do you escape things when query-searching text?

Suppose I want to know all the documents of a particular type that use the %RED% macro in their text. This seems like a ready-made use for query searching a-la:
%SEARCH{"DocumentClass.DocumentType='Document' AND text ~ '*%RED%*'" type="query" bla bla bla...}%
Except it doesn't work!

How to escape the "%" characters in this case? Using "$percnt" doesn't work.

As a workaround you can
%SEARCH{"DocumentClass.DocumentType='Document' AND text ~ '*RED%*'" type="query" bla bla bla...}%

but that would also get %FRED% etc.

-- BigBaaadBob - 15 Dec 2009

Interesting question; no, $percnt won't work. I'm struggling to think of a way to do that. Logically

Searched: TopicTitle~'\%RED\%'
Number of topics: 0

ought to work.

-- CrawfordCurrie - 16 Dec 2009

Yes, I tried that (escaping with backslashes) and I agree it ought to work, but it doesn't for me. Is this a bug or a feature request?

-- BigBaaadBob - 16 Dec 2009

More an oversight. See Tasks.Item2508. The patch is against the trunk, but the fix to Foswiki/Infix/Parser is so trivial, you may want to try applying it yourself (forget about the unit tests).

-- CrawfordCurrie - 16 Dec 2009

QuestionForm edit

Subject Topic Markup Language and applications
Extension
Version Foswiki 1.0.7
Status Answered
Topic revision: r4 - 16 Dec 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy