I'm very excited to try out ikiwiki, since it should fit my purposes extremely well, but I'm having trouble with the search plugin. I'm pretty sure that right after I installed ikiwiki and needed dependencies, the search plugin was working fine. However, now when I try to use search, I get "Exception: Unknown function `this'" error on a blank page. I'm not sure how I should go about debugging this issue - my server's (I use Lighttpd 1.4.22) error log has no mention of the exception and there's nothing in /var/log/syslog either.
What might be causing this exception and how I might go about debugging exceptions?
> caused by a problem with the xapian database. Failing everything, you
> could switch to [[google_search_plugin|plugins/google]]. --[[Joey]]
2010-03-08 03:09:00 +01:00
>> Thanks, Joey. With your help I was able to figure out what was wrong. It's a fun little bug (or feature): the title of my wiki had string `$this` in title and that's what was causing the omega binary to choke. My wiki's title was inserted without escaping into the query template used by omega. Omega treated `$this` in the title as a function name and threw an exception because no such function was defined. To avoid this behavior, I used an html entity in the title, so `$this` became `$this`. I don't think that the wiki title should be inserted into the template without escaping - it can produce an error that's not trivial to debug. If users want to modify the html in the title, they should be editing respective templates, not typing html in the wiki title input. What do you think? --[[dkobozev]]
>>> Sounds like a bug in omega, and one that probably would affect other
>>> users of omega too. Ikiwiki could work around it by pre-escaping
>>> data before passing it to xapian. I have not quite managed to reproduce it though;
>>> tried setting a page title to '$this' and 'foo $this'.
>>> That's with version 1.0.18 of omega.
>>> --[[Joey]]
2010-03-08 05:53:05 +01:00
>>>> I tried it with both omega 1.0.13 and omega 1.0.18 and the issue is present in both. If I view the contents of {$srcdir}/.ikiwiki/xapian/templates/query, I can see that the wiki title is inserted verbatim and there are calls to `$setmap`, `$set` and `$def` etc in the template. --[[dkobozev]]
>>>>> I don't see how that's relevant. It would help if you showed me
>>>>> exactly something that could be inserted into a page to cause the
>>>>> problem. --[[Joey]]
2010-03-09 11:50:03 +01:00
>>>>>> Correct me if I'm wrong: ikiwiki generates an Omega template from its own templates, such as searchquery.tmpl and puts it into {$srcdir}/.ikiwiki/xapian/templates/query. Omega has its own template syntax, where function names are prefixed with dollar signs (`$`). So, when I call my wiki `$foobar`, ikiwiki generates an Omega template that looks like this snippet: