Hi,
I'm trying to implement a new feature for spelling correction, I've outlined it here:
{link saved}
and here if you view source:
{link saved}
The engine name is spellcheck. I tried using this:
<?php
function Spell($record)
{
if (($record["RESULTSET-ENGINECODE"] == "cs")) {
if (($record['RESULTSET@2-RESULTSCOUNT'])) {
echo "Did You Mean: <a href='?q=" . $record['RESULTSET/CORRECTION'] . "' style='text-decoration:none;'>" . $record['RESULTSET/CORRECTION'] . "</a>";
}
}
?>
But that doesn't work. Can you help me figure out how to add this?
Thanks,
Shawn
Hi Shawn,
Try the following code, which is pretty much the same, and seems to work correctly:
<?php
require("MagicParser.php");
function Spell($record)
{
if ($record["RESULTSET-ENGINECODE"] == "ss")
{
if ($record['RESULTSET@2-RESULTSCOUNT'])
{
echo "Did You Mean: <a href='?q=" . $record['RESULTSET/CORRECTION'] . "' style='text-decoration:none;'>" . $record['RESULTSET/CORRECTION'] . "</a>";
}
}
}
$url = "{URL SNIPPED}";
MagicParser_parse($url,"Spell","xml|AJRESULTS/ENGINE/");
?>
Here's the output running on this server:
http://www.magicparser.com/examples/spell.php
Cheers,
David.
Hi Shawn,
Just looking over it very quickly, I notice that you are using:
if ($record["RESULTSET-ENGINECODE"] == "cs")
..wheras the value in the result you linked to is "ss", so as it stands nothing would be displayed...
Cheers,
David.