Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

SearchCache and XMLResults don't work together

Quote Reply
SearchCache and XMLResults don't work together
Has anyone else noticed this, or got a remedy?

The XMLResults and SearchCache (tandat, 1.01) plugins are both very useful, but don't work as a team.

If SearchCache is installed, it doesn't cache XML search results, but the HTML results instead. So a first hit on http://OUR_DOMAIN.org/cgi-bin/directory/search.cgi?query=elephants&bool=and&substring=0&xml_feed=1 produces the expected result, like this:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="0.91">
<channel>

<title> OUR_DOMAIN Directory </title>

<item>
<title> TITLE_1 </title>
<link> URL_1 </link>
<description> DESCRIPTION_1 </description>
</item>

<item>
<title> TITLE_2 </title>
<link> URL_2 </link>
<description> DESCRIPTION_2 </description>
</item>

</channel>
</rss>

but subsequent hits omit the items:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="0.91">
<channel>

<title> OUR_DOMAIN Directory </title>

</channel>
</rss>

It would be great if we could cache the XML results, but we can't figure out why it doesn't happen.
Quote Reply
Re: [YoYoYoYo] SearchCache and XMLResults don't work together In reply to
I've noticed it. It works on the first uncached searched, but after it's cached, it doesn't. Since the XMLResults doesn't work with it, it makes the Remote Search script not work. There should be something added to the Search Cache plugin to keep it from caching searches with xml_feed=1 in them.

http://www.gossamer-threads.com/...arch%20cache;#209006

Sean
Quote Reply
Re: [SeanP] SearchCache and XMLResults don't work together In reply to
In Reply To:
There should be something added to the Search Cache plugin to keep it from caching searches with xml_feed=1 in them.

That could be done in SearchCache.pm, sub log_query by checking for xml_feed as a substring of $ENV{'QUERY_STRING'} (how do you do that in Perl?) -- if found, exit the function.

But ideally, SearchCache would cache the xml results as xml rather than as HTML. I think it might be casued by the XMLResults plugin, not by SearchCache.
Quote Reply
Re: [SeanP] SearchCache and XMLResults don't work together In reply to
In Reply To:
There should be something added to the Search Cache plugin to keep it from caching searches with xml_feed=1 in them.

Workaround

In SearchCache.pm, sub log_query, about line 61, add the code in red :
Code:
my ($args) = shift;

if ($IN->param('xml_feed')) {
return $args;
}

Last edited by:

YoYoYoYo: Sep 2, 2002, 3:38 AM
Quote Reply
Re: [YoYoYoYo] SearchCache and XMLResults don't work together In reply to
I just got around to trying your fix, and it looks like it is working fine now. Thanks...

Sean